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?

Nick
  • 3,496
  • 7
  • 42
  • 96

3 Answers3

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.

Nick
  • 3,496
  • 7
  • 42
  • 96
0

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.

Moa
  • 1,456
  • 4
  • 20
  • 1
    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. – Nick Jul 19 '22 at 21:40
  • 1
    `nvm install --latest-npm` returns `Node.js vlatest-npm.0.0 is only available in 32-bit`. – Nick Jul 19 '22 at 21:41
0

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.

CyberMessiah
  • 1,084
  • 11
  • 14