Skip to content

Loading…

Cannot upgrade from npm@~1.2 to npm@1.4.4 on Windows 7 #4809

Closed
bryanburgers opened this Issue · 8 comments

6 participants

@bryanburgers

On Windows 7, using git bash.

$ npm version
{ http_parser: '1.0',
  node: '0.10.3',
  v8: '3.14.5.8',
  ares: '1.9.0-DEV',
  uv: '0.10.3',
  zlib: '1.2.3',
  openssl: '1.0.1e',
  npm: '1.2.17' }
$ npm install npm -g
npm http GET https://registry.npmjs.org/npm
npm http 304 https://registry.npmjs.org/npm
C:\Users\bryan\AppData\Roaming\npm\npm -> C:\Users\bryan\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm WARN unmet dependency C:\Users\bryan\AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-client requires semver@'^2.2.1' but will load
npm WARN unmet dependency C:\Users\bryan\AppData\Roaming\npm\node_modules\npm\node_modules\semver,
npm WARN unmet dependency which is version 2.2.1
npm@1.4.4 C:\Users\bryan\AppData\Roaming\npm\node_modules\npm

I tried to update to npm@1.3.0 to see if a 1.3 → 1.4.4 update would go smoother. But when I performed an install npm@1.3.0, it apparently updated a different npm in a different folder.

$ which npm
/c/Program Files/nodejs/npm

$ npm -v
1.2.17

$ npm install npm@1.3.0 -g
npm http GET https://registry.npmjs.org/npm/1.3.0
npm http 304 https://registry.npmjs.org/npm/1.3.0
npm http GET https://registry.npmjs.org/normalize-package-data
npm http 304 https://registry.npmjs.org/normalize-package-data
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/github-url-from-git
npm http 304 https://registry.npmjs.org/semver
npm http 304 https://registry.npmjs.org/github-url-from-git
C:\Users\bryan\AppData\Roaming\npm\npm -> C:\Users\bryan\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm@1.3.0 C:\Users\bryan\AppData\Roaming\npm\node_modules\npm
└── normalize-package-data@0.1.7 (github-url-from-git@1.1.1, semver@1.1.4)

$ npm -v
1.2.17
@bryanburgers
$ which npm
/c/Program Files/nodejs/npm

That doesn't match where npm@1.3.0 was downloaded, which is probably the issue. What's the best way to resolve this?

@jakub-g

You can rename/delete npm and npm.cmd in /c/Program Files/nodejs or change the order of items in your PATH (right now /c/Program Files/nodejs/npm is before your local npm folder).

However when you update node, the files in former folder will get recreated probably.

@bryanburgers

Update:

npm@1.3.0 did install correctly in a different folder. From that, I was able to install npm@1.4.4, and it replaced my original npm.

$ cd /c/users/bryan/AppData/Roaming/npm
$ npm -v
1.3.0
$ npm install npm -g
$ npm -v
1.3.0
$ cd ~
$ which npm
/c/Program Files/nodejs/npm
$ npm -v
1.4.4

So this only seems to be an issue updating from npm@~1.2 to npm@~1.4.

@domenic
npm member

Just use the installer from nodejs.org, generally.

@domenic domenic closed this
@ymeine

I wouldn't present the installer as the main recommended option.

First, for someone working with a custom portable installation, it wouldn't suit. But in this case I agree those people should already have enough knowledge to fix this kind of issue.

But even for a user who initially installed everything with the installer, I think running it again is not always the right solution, except if it is well designed for updates. That I don't know.

So I'm not against the use of the installer, I would just also mention the possibility to manually download the npm package here: http://nodejs.org/dist/npm/, and put it in the global node_modules.

@domenic
npm member

It is well designed for updates. It is the primary recommended way of updating node and npm.

@ymeine

Ok cool, didn't know that! :)

Well, for me I have installed everything by hand, to prevent any automatic configuration and OS data alteration (registry, common directories, environment variables, etc). So using the installer is not possible for me, except if it would be able to guess my file system layout for this installation only using the content of the PATH environment variable.

@othiym23 othiym23 added the support label
@barcadictni

Thank you so much @jakub-g for your answer. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.