2

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?

4 Answers 4

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Sweet! Glad you've got that sorted.
0
+50

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.

2 Comments

I think NVM_SYMLINK is correct, especially since npm does work for the already installed Node versions. The different Node versions are located in subfolders inside C:\Users\User\AppData\Roaming\nvm\ . The Node versions for which npm works has for example ...\nvm\9.8.0\node_modules\ with npm and nodemon etc. inside that folder. But for newly installed Node versions that node_modules folder, while it does exist, is empty.
nvm install --latest-npm returns Node.js vlatest-npm.0.0 is only available in 32-bit.
0

Other solution is to install it manually, but i think the problem is with nvm version 1.1.7 :

Go to https://nodejs.org/dist/ and download the nodejs version you want Copy files inside nvm nodejs folder, to get the folder path run "nvm root"

Comments

-1

Another solution was to just pick another Node version. I am not sure for a particular reason but I used via NVM at least 4 different version and they are all fine. Only the following version 14.17.0 seems buggy.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.