Igal Ore
Igal Ore

Reputation: 311

Troubles using NVM4W

I had observed that each new installations of Node.JS + NPM lately fails, were installation (nvm install 8.11.1 ) seems to work out correctly:

C:\WINDOWS\system32>nvm install 8.11.1
Downloading node.js version 8.11.1 (64-bit)...
Complete
Creating C:\Users\XXXXXXXXXXX\AppData\Roaming\nvm\temp

Downloading npm version 5.6.0... Complete
Installing npm v5.6.0...

Installation complete. If you want to use this version, type

nvm use 8.11.1

On "npm --version" getting this error reply:

module.js:549
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
module.js:549
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

When checking in Windows Explorer folder "C:\Program Files\nodejs\node_modules" are empty, where it should have "npm" scripts in them.

I suspect that NPM mirror download https://github.com/npm/npm/archive/, which is default not correct anymore when putting in the browser it leads to 404 GitHub page.

1) Does anyone encounter the same issue recently? if yes how did you resolved it?
2) Any idea where those NPM mirror version could be found, somehow not arriving to find those.

If that information is relevant, I'm running windows 8.1 64bit machine.

Upvotes: 0

Views: 1253

Answers (1)

Igal Ore
Igal Ore

Reputation: 311

Seems that issue is known under https://github.com/coreybutler/nvm-windows/issues/302. For a moment best workaround proposed by roman-spiridonov:

  1. nvm install 8.8.1 (or another version you want). Do not switch to it (yet).
  2. Download the *.zip of the same node version from official site (https://nodejs.org/en/download/current/)
  3. Substitute the contents of %APPDATA%/nvm/v8.8.1/npm for the npm folder from the downloaded archive
  4. nvm use 8.8.1
  5. Enjoy

Upvotes: 1

Related Questions