sourcemeta/alterschema

Dependency on rimraf not automated causing npm installation to fail

Closed this issue · 9 comments

$ npm install --global alterschema
npm ERR! code 127
npm ERR! path /usr/local/lib/node_modules/alterschema/node_modules/@hyperjump/json-schema-core
npm ERR! command failed
npm ERR! command sh -c npx rimraf dist
npm ERR! sh: rimraf: command not found
npm ERR! npm ERR! code 127
npm ERR! npm ERR! path /usr/local/lib/node_modules/alterschema/node_modules/@hyperjump/json-schema-core
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c rimraf "dist"

The fix was just to install rimraf manually: npm install --global rimraf

Looks like this is coming from https://github.com/hyperjump-io/json-schema-validator, one of Alterschema's dependencies. Let me file an issue there for you.

cc @jdesrosiers

@timbunce What operating system, Node.js and npm versions are you running? From what I understand, npx rimraf should be pulling rimraf on demand if it's not available, so not sure why it's not working for you.

Not working for me either. I am using Node v18.4.0. I am using Volta to manage Node versions (and npm/yarn/pnpm). Could volta be at fault here?

@Zizico2 Does npx usually work for you in that environment? What happens if you do npx rimraf directly from within your terminal session?

A potential workaround while we get this fixed upstream would be to install the package without running any scripts. For example:

npm install --global --ignore-scripts alterschema

I believe Yarn has an equivalent.

@Zizico2 Does npx usually work for you in that environment? What happens if you do npx rimraf directly from within your terminal session?

It works just fine

According to hyperjump-io/json-schema#16, the problem is reproducible only when installing using sudo. Can you confirm this is the case for you too?

Hi @timbunce and @Zizico2 , this issue has been fixed upstream. I'm releasing alterschema with the upgrade as v1.0.5 to NPM. Please let me know if you still hit this one!