Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npm is not being updated with node on windows 10 #31056

Closed
alexhx5 opened this issue Dec 21, 2019 · 5 comments
Closed

Npm is not being updated with node on windows 10 #31056

alexhx5 opened this issue Dec 21, 2019 · 5 comments

Comments

@alexhx5
Copy link

alexhx5 commented Dec 21, 2019

  • Version: 13.5.0
  • Platform: x64 Windows 10 1909

Problem:

Npm is not being updated when you update node on windows 10.

Most likely because I once ran npm -g install npm@<version> which installs a separate npm on Windows.

Reproduction:

  • Downloaded node-v13.5.0-x64.msi.
  • Expected node to be updated to 3.5.0 and npm to 6.13.4
  • Node was successfully updated but the npm is still 6.11.2 (checked by running npm -v)

Running command: npm gives me the following:

C:\Users\USER>npm
npm WARN npm npm does not support Node.js v13.5.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    C:\Users\USER\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

[email protected] C:\Users\USER\AppData\Roaming\npm\node_modules\npm
@alexhx5
Copy link
Author

alexhx5 commented Dec 21, 2019

Is there a good reason it is designed like this? Why can't it just be stored in one place, instead of branching out when you try to update npm with npm -g install npm

@joaocgreis
Copy link
Member

Yes, this happens because npm install -g npm was run. This is expected, when you install npm you take control over the version of npm that you run, same as with all other modules. This has the advantage that any user in the system can update npm for their own account without administrator privileges. Also, it does not make sense for the installer to look for npm installations for any user in any prefix. It is possible that a better solution could be implemented, but it's not likely to be simple.

You can easily fix this by running npm install -g npm to update npm (possibly an even newer version than the one bundled with node). Or run npm uninstall -g npm to revert to the npm installed with node.

@Trott
Copy link
Member

Trott commented Dec 26, 2019

I'm going to close this, but feel free to comment or re-open if the issue/question here hasn't been adequately addressed.

@Trott Trott closed this as completed Dec 26, 2019
@alexhx5
Copy link
Author

alexhx5 commented Dec 26, 2019

@joaocgreis thanks for the explanation, it makes sense to me now

@kipio
Copy link

kipio commented Dec 17, 2022

For me following didn't worked:
npm install -g npm

But following worked:
npm install --global npm@latest

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

No branches or pull requests

4 participants