Home > Mobile >  Doesn't install NPM when I install a new Node version using NVM
Doesn't install NPM when I install a new Node version using NVM

Time:07-20

Whenever I update Node with nvm, npm is no longer available.

  1. nvm install 14.19.3 > It says it's also downloading and installing npm.
  2. npm > Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
  3. Looking in C:\Users\Username\AppData\Roaming\nvm\v14.19.3, the subfolder node_modules is empty. It doesn't seem to have installed npm along with nvm, even though there was no error upon nvm install 14.19.3.

From this post I understand the cause of a problem like this generally is a conflict in the environment variables of the OS (I'm using VSC on a Windows 10 machine).

But I can't find anything wrong there: PATH includes NVM_HOME and NVM_SYMLINK, which respectively point to C:\Users\Username\AppData\Roaming\nvm and C:\Program Files\nodejs.

How can I get this new version of Node to work?

CodePudding user response:

Shouldn't the NVM_SYMLINK point to %AppData%\npm or C:\Users\Username\AppData\npm?

Have you tried to: nvm install-latest-npm or nvm install --latest-npm?

Also check it out this answer as it may help.

CodePudding user response:

I had to update my nvm for windows version (from 1.1.7 to 1.1.9).

After this I uninstalled the Node version and installed it again with the new nvm version. Now it did install NPM along with Node.

nvm use 14.20.0 (the new Node version I installed) gave an error however:

exit status 5: Access is denied.

Running the terminal / Visual Studio Code with administrator privilages solved this issue and I was able to successfully switch Node versions.

  • Related