Skip to content
This repository was archived by the owner on Sep 11, 2021. It is now read-only.

Can't update from NPM 5.6.0 to 5.7. #124

Open
itpcc opened this issue Mar 18, 2018 · 8 comments
Open

Can't update from NPM 5.6.0 to 5.7. #124

itpcc opened this issue Mar 18, 2018 · 8 comments

Comments

@itpcc
Copy link

itpcc commented Mar 18, 2018

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

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.

+ npm@5.7.1
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' }
@ZeVS777
Copy link

ZeVS777 commented Mar 18, 2018

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

@felixrieseberg
Copy link
Owner

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!

@SOSANA
Copy link

SOSANA commented Apr 16, 2018

1+ having same issue as above using nvm-windows

@lysla
Copy link

lysla commented Apr 23, 2018

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 (coreybutler/nvm-windows#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.

@andyghiuta
Copy link

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 with npm 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)

@edm00se
Copy link

edm00se commented May 10, 2018

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

@jdalton
Copy link

jdalton commented Jun 17, 2018

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 jasongin/nvs#66.

@jasongin
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants