Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing multiple npm versions

Tags:

Is it possible to install multiple versions of npm for different projects that I am working on or are the npm installations always global? (Windows 10)

Are also tried installing different versions with https://github.com/marcelklehr/nodist but it seems to affect only the node version, not the npm version.

Or does npm version actually matter? Can I just use the newest npm version even when a project says the requirement is a certain npm version?

like image 304
blub Avatar asked Feb 04 '16 13:02

blub


People also ask

Can I install multiple versions of npm?

So you can have multiple versions of the same package running in your app and you can work on the upgrades mitigating possible issues.

How do I install two versions of the same package?

When we install a package using the npm install package-name command, it will download the current stable version of the package inside node_modules folder and add it to package. json file. To install multiple versions of the same package, we need to use the package alias syntax which is supported from the npm v6. 9.0.

Can you have multiple versions of node installed?

You have the latest and greatest version of Node. js installed, and the project you're about to work on requires an older version. In those situations, the Node Version Manager (nvm) is a great tool to use, allowing you to install multiple versions of Node. js and switch between them as you see fit.


1 Answers

You can install multiple versions of npm by installing multiple versions of node. To do this, you can use nvm-windows. Each different installation of node installs a different version of npm

To use a different version of node and nvm in a project, you simple need to switch:

nvm use 5.0 

You can also create a .nvmrc file containing the version number in the project root directory. nvm will use the specified version of node for that project.

like image 176
gnerkus Avatar answered Sep 17 '22 17:09

gnerkus