Make sure you have reviewed the common issues and existing issues before submitting a new issue.
If this is a question about how to use NVM4W, please use stackoverflow instead.
If this is an issue regarding antivirus, make sure you search the existing issues first.
[ ] Windows Server 2016
[ ] My Windows installation is non-English.
Run nvm version
if you don't know.
I expect npm-version-windows
PS C:\WINDOWS\system32> npm install npm-windows-upgrade -g
C:\Program Files\nodejs\npm-windows-upgrade -> C:\Program Files\nodejs\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade.js
Upgrading npm (fallback method)...
You wanted to install npm 6.13.4, but the installed version is 6.9.0.
A common reason is an attempted "npm install npm" or "npm upgrade npm". As of today, the only solution is to completely uninstall and then reinstall Node.js. For a small tutorial, please see https://github.com/felixrieseberg/npm-windows-upgrade#usage.
Please consider reporting your trouble to https://aka.ms/npm-issues.
Debug Information:
node: 12.6.0 | v8: 7.5.288.22-node.14 | uv: 1.30.1 | zlib: 1.2.11 | brotli: 1.0.7 | ares: 1.15.0 | modules: 72 | nghttp2: 1.38.0 | napi: 4 | llhttp: 1.1.4 | http_parser: 2.8.0 | openssl: 1.1.1c | cldr: 35.1 | icu: 64.2 | tz: 2019a | unicode: 12.1 | os: win32 x64 | OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.17134 N/A Build 17134
I would like to get the latest npm package 6.13.4 [no security issues] with node version 12.13.1
https://nodejs.org/en/blog/vulnerability/december-2019-security-releases/ trying to get the latest npm version for this security issue.
This worked for me, but I won't swear by it as the answer for everyone:
nvm install
to set up the node installation.nvm use
to set the current version.explorer.exe $env:NVM_SYMLINK
. From Command Prompt, it's explorer.exe %NVM_SYMLINK%
.)
node (Join-Path $env:NVM_SYMLINK 'node_modules\npm\lib\npm.js') install -g npm
This worked for me because when I ran npm install -g npm
, the error I was getting was that the top level script files were "outside" the installation, which I assume means that they weren't recognized as managed by it. I don't know why npm thought it didn't control those files, but once they were out of its way, it updated just fine.
This works as well. https://github.com/coreybutler/nvm-windows/issues/300#issuecomment-571237846
@myty Again, I can't speak for everyone, but npm-windows-upgrade failed miserably for me. Its error message was even more cryptic and unhelpful than the one I got from npm install -g npm
. (I don't recall the exact error message; I think it was just extremely generic.) It's possible we were facing different issues, though.
This works as well. #300 (comment)
This has worked for me in the past, but now ,whilst trying to update npm from 6.13.4 to 6.13.6 (using node 12.16.0), I get the following error:
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\node_modules\.bin\semver
npm ERR! Refusing to delete C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\node_modules\.bin\semver: is outside C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\node_modules\semver and not a link
npm ERR! File exists: C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\node_modules\.bin\semver
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\johns\AppData\Roaming\npm-cache\_logs\2020-02-18T20_00_16_440Z-debug.log
Anybody else hit this issue and been able to resolve? I did try with --force but same error.
I had Nodist installed prior to nvm-windows. It left a .npmrc
file under home directory (%userprofile%
). I had to remove it and try nvm use
command again to get everything right.
Most helpful comment
This worked for me, but I won't swear by it as the answer for everyone:
nvm install
to set up the node installation.nvm use
to set the current version.explorer.exe $env:NVM_SYMLINK
. From Command Prompt, it'sexplorer.exe %NVM_SYMLINK%
.)node (Join-Path $env:NVM_SYMLINK 'node_modules\npm\lib\npm.js') install -g npm
This worked for me because when I ran
npm install -g npm
, the error I was getting was that the top level script files were "outside" the installation, which I assume means that they weren't recognized as managed by it. I don't know why npm thought it didn't control those files, but once they were out of its way, it updated just fine.