When I run npm install -g grunt-cli I get output about install location:
/home/XXX/.nvm/versions/node/v8.11.4/bin/grunt -> /home/XXX/.nvm/versions/node/v8.11.4/lib/node_modules/grunt-cli/bin/grunt although my node installation is in different folder:

which npm

Some time back, I installed node using apt install, which installed Node.js 8.11.4. After it, I installed nvm. I was not happy with it and I uninstalled both, deleted ~/.nvm directory. Now npm install -g grunt-cli command creates ~/.nvm directory and does not add /home/XXX/.nvm/versions/node/v8.11.4/bin/grunt to the path (as documentation states).
None of environment variables point to ~/.nvm folder.
Why npm uses some leftovers and does not install in location where node is?

  • When running sudo npm install -g grunt-cli grunt is installed at correct location and grunt is added to bin folder (/opt/node.js/node/bin/grunt) – zdenko.s Feb 25 at 12:55

Trick was in ~/.npmrc file. It contained line:


It is leftover of nvm installation. After commenting this line installation was done to correct location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.