npm-windows-upgrade
npm-windows-upgrade copied to clipboard
Can't update from NPM 5.6.0 to 5.7.
I try to update NPM using npm-windows-upgrade on Administrator's PowerShell. My computer is run on Windows 10. And it doesn't work as shown as following:
PS
-
If you need any information, please reply. I'll provide it for you ASAP.
-
http://aka.ms/npm-issues is redirected to https://www.microsoft.com/th-th/...
Log console:
PS C:\WINDOWS\system32> npm-windows-upgrade --npm-version latest
npm-windows-upgrade v4.1.0
Checked system for npm installation:
According to PowerShell: C:\Program Files\nodejs
According to npm: C:\Program Files\nodejs
Decided that npm is installed in C:\Program Files\nodejs
Upgrading npm... \
Upgrading npm (fallback method)... /
You wanted to install npm 5.7.1, but the installed version is 5.6.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 http://aka.ms/fix-npm-upgrade.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Debug Information:
http_parser: 2.7.0 | node: 8.9.4 | v8: 6.1.534.50 | uv: 1.15.0 | zlib: 1.2.11 | ares: 1.10.1-DEV | modules: 57 | nghttp2: 1.25.0 | openssl: 1.0.2n | icu: 59.1 | unicode: 9.0 | cldr: 31.0.1 | tz: 2017b | os: win32 x64 | OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.16299 N/A Build 16299
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> npm i npm
npm WARN saveError ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json'
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.
+ [email protected]
added 533 packages in 35.931s
PS C:\WINDOWS\system32> npm version
{ npm: '5.6.0',
ares: '1.10.1-DEV',
cldr: '31.0.1',
http_parser: '2.7.0',
icu: '59.1',
modules: '57',
nghttp2: '1.25.0',
node: '8.9.4',
openssl: '1.0.2n',
tz: '2017b',
unicode: '9.0',
uv: '1.15.0',
v8: '6.1.534.50',
zlib: '1.2.11' }
I'm using nvm https://github.com/coreybutler/nvm-windows There is an issue https://github.com/coreybutler/nvm-windows/issues/300 So the same happened if you upgrade using npm-windows-upgrade
npm-windows-upgrade v4.1.0 npm-windows-upgrade Powershell: Attempting to spawn PowerShell child +0ms npm-windows-upgrade PowerShell: Stdout received: Unrestricted npm-windows-upgrade +280ms npm-windows-upgrade PowerShell: Resolving unrestricted (true) +37ms ? Which version do you want to install? 5.7.1 npm-windows-upgrade PowerShell: Stdout received: C:\Program Files\nodejs\npm.cmd npm-windows-upgrade +10s npm-windows-upgrade PowerShell: _getPathFromPowerShell() resolving with: C:\Program Files\nodejs +32ms npm-windows-upgrade PowerShell: _getPathFromNpm() resolving with: C:\Program Files\nodejs +559ms npm-windows-upgrade Utils: isPathAccessible(): C:\Program Files\nodejs\node_modules\npm exists +1ms npm-windows-upgrade Utils: isPathAccessible(): C:\Program Files\nodejs\node_modules\npm exists +0ms Checked system for npm installation: According to PowerShell: C:\Program Files\nodejs According to npm: C:\Program Files\nodejs Decided that npm is installed in C:\Program Files\nodejs npm-windows-upgrade Upgrader: Chosen npm path: C:\Program Files\nodejs +1ms npm-windows-upgrade Starting upgrade +1ms Upgrading npm... - npm-windows-upgrade PowerShell: Stdout received: Assuming npm in C:\Program Files\nodejs\node_modules\npm npm-windows-upgrade +418ms Upgrading npm... / npm-windows-upgrade PowerShell: Stderr received: npm +905ms npm-windows-upgrade PowerShell: Stderr received: WARN invalid config loglevel="win" npm-windows-upgrade +3ms Upgrading npm... - npm-windows-upgrade PowerShell: Stderr received: npm ERR! path C:\Program Files\nodejs\npm.cmd npm-windows-upgrade npm ERR! code +47s npm-windows-upgrade PowerShell: Stderr received: EEXIST npm-windows-upgrade +4ms npm-windows-upgrade PowerShell: Stderr received: npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link npm-windows-upgrade npm ERR! File exists: C:\Program Files\nodejs\npm.cmd npm-windows-upgrade npm ERR! Move it away, and try again. npm-windows-upgrade +3ms npm-windows-upgrade PowerShell: Stderr received: npm-windows-upgrade +37ms Upgrading npm... \ npm-windows-upgrade PowerShell: Stderr received: npm ERR! A complete log of this run can be found in: npm-windows-upgrade npm ERR! C:\Users\ruspo\AppData\Roaming\npm-cache_logs\2018-03-18T16_32_59_957Z-debug.log npm-windows-upgrade +30ms npm-windows-upgrade PowerShell: Stdout received: All done! npm-windows-upgrade +21ms Upgrading npm... |
Upgrading npm (fallback method)... |
You wanted to install npm 5.7.1, but the installed version is 5.6.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 http://aka.ms/fix-npm-upgrade.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Debug Information:
http_parser: 2.7.0 | node: 8.10.0 | v8: 6.2.414.50 | uv: 1.19.1 | zlib: 1.2.11 | ares: 1.10.1-DEV | modules: 57 | nghttp2: 1.25.0 | openssl: 1.0.2n | icu: 60.1 | unicode: 10.0 | cldr: 32.0 | tz: 2017c | os: win32 x64 | OS Name: Майкрософт Windows 10 Pro OS Version: 10.0.16299 N/A Build 16299
Oh boy, it appears that we were not able to execute the fallback installation in the correct directory. I'll take a look, thank you!
1+ having same issue as above using nvm-windows
Same here ~ wanting to update npm 5.6 to 5.8 (using nvm-windows for node version management) and I just tried update npm with npm-windows-upgrade. On win 1064bit.
Edit: I found a solution around nvm-windows topics from @arfaWong (https://github.com/coreybutler/nvm-windows/issues/300), i quote
just remove the npm and npm.cmd files from the nodejs location, move dir node_modules/npm from the nodejs location to another location, and run node npm-cli.js i -g npm@latest inside bin dir in the moved folder.
Worked for me and other guys on that topic too. This doesn't solve the issue but it's a nice workaround for now.
Had the same problem with nvm-windows and found a quick workaround.
nvm install directory is C:\nvm; nodejs is C:\nodejs.
After installing nvm and a version of node (eg 8.9.4), I installed npm-windows-upgrade. Then opened git bash and did the following:
- view the config prefix with
npm config get prefix(save the output for later) - changed the config prefix with
npm config set prefix "${APPDATA}/npm" -g - run
npm-windows-upgrade. It will install the new version of npm in${APPDATA}/npm(you can view the full path withnpm config get prefix). - open above folder and copy all its contents over the version of node you have running with nvm (eg: c:\nvm\8.9.4). It should have
node_modules,npm,npm.cmd,npx,npmx.cmd - change the prefix to the initial one with
npm config set prefix "C:\nodejs" -g(update the path accordingly with the one saved at first step)
The same here from nvs, just with the slightly different path.
PowerShell (elevated) console output...
PS C:\WINDOWS\system32> npm-windows-upgrade --npm-version latest
npm-windows-upgrade v4.1.0
Checked system for npm installation:
According to PowerShell: C:\Users\MyUserName\AppData\Local\nvs\default
According to npm: C:\Users\MyUserName\AppData\Local\nvs\default
Decided that npm is installed in C:\Users\MyUserName\AppData\Local\nvs\default
Upgrading npm... |
Upgrading npm (fallback method)... -
You wanted to install npm 6.0.1, but the installed version is 5.6.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 http://aka.ms/fix-npm-upgrade.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Debug Information:
http_parser: 2.8.0 | node: 8.11.1 | v8: 6.2.414.50 | uv: 1.19.1 | zlib: 1.2.11 | ares: 1.10.1-DEV | modules: 57 | nghttp2: 1.25.0 | openssl: 1.0.2o | icu: 60.1 | unicode: 10.0 | cldr: 32.0 | tz: 2017c | os: win32 x64 | OS Name: Microsoft Windows 10 Pro Insider Preview
OS Version: 10.0.17666 N/A Build 17666
Just wanted to second @edm00se and mention that I'm seeing a similar issue when using npm-windows-upgrade with nvs. My issue (which has some more debug info from npm-windows-upgrade) is https://github.com/jasongin/nvs/issues/66.
The latest nvs includes a fix that enables npm upgrades to work seamlessly. There's no need for npm-windows-upgrade either when working with node that was installed by nvs. Instead, npm i -g npm just works as expected.