0

I have a node module rimraf. It definitely exists based on being able to click on it
and land on its folder under the node_modules. But I get errors saying command not found
for rimraf.

Tried to delete the entire node_module.
Also tried following commands.

npm ci 

and

npm cache clear --force
npm i

No errors, some warning messages about licensing and
No repository field found to a module drive-module.

Now when I run following command, I end up with error.

npm run build

Error

sh: rimraf: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! dyna-modules@0.2.0 build: `rimraf build && bundle-trace-app --clientConfig webpack/client.config.js --serverConfig webpack/server.config.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the dyna-module@0.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

What would be the issue? Considering that rimraf exists?

karvai
  • 2,417
  • 16
  • 31
  • What platform are you on (Windows, macOS...)? Have you checked to see if there is a file called rimraf in `node_modules/.bin`? – Benjamin Davies Mar 05 '21 at 01:16
  • If you didn't install it globally it's likely not on your PATH, so run it using `npx`. – jarmod Mar 05 '21 at 01:37
  • @BenjaminDavies Am on mac. There isn't one. Should there be? – karvai Mar 05 '21 at 08:10
  • @jarmod IT's not meant to be global. Is inside my package.json file as a dependency. – karvai Mar 05 '21 at 08:11
  • See [this response](https://stackoverflow.com/questions/9679932/how-to-use-executables-from-a-package-installed-locally-in-node-modules) that explains options for using `npx` or adding `node_modules/.bin` to your PATH. You should also check that `rimraf` is indeed in `node_modules/.bin`. – jarmod Mar 05 '21 at 13:49

1 Answers1

1

maybe you can try using this command

rm -rf node_modules package-lock.json
or delete it manually before re-installing your node-modules