简体   繁体   中英

Are there constraints on which npm version I can use based on my node version?

Is there any way to know if I can use a specific version of npm with a specific version of node?

I want to use latest npm (6.4.1 at the time of writing) with latest LTS (8.11.4 at time of writing).

I realise that the versions are pretty close that there might not be a problem but I have learned not to make assumptions about stuff I don't know :P

I would suggest you install nvm ( https://github.com/creationix/nvm/blob/master/README.md ) and let it do the version management.

Usage: To download, compile, and install the latest release of node, do this:

nvm install node

And then in any new shell just use the installed version:

nvm use node

Or you can just run it:

nvm run node --version

Or, you can run any arbitrary command in a subshell with the desired version of node:

nvm exec 4.2 node --version

You can also get the path to the executable to where it was installed:

nvm which 5.0

Read more: Managing Node.js Versions with nvm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM