Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use different versions of node/npm on a single system?

My questions says it all.

Is it possible to install and use a different version of npm per project on a single system?

like image 724
tlovely Avatar asked Apr 30 '16 17:04

tlovely


People also ask

Can I have multiple versions of npm?

The good news is that you can have it done directly via NPM! What can be done in this case is an idea called "package alias". So you can have multiple versions of the same package running in your app and you can work on the upgrades mitigating possible issues.

Can we have two different version of node js in the same system?

NVM allows installing multiple node js versions on the same machine and switching between the required node js version.

How do I force npm to specific version?

npm allows you to use SemVer to specify the package version to install. You can use a caret (^) character to specify the latest minor version to install or a tilde (~) character to specify the latest patch version to install.


2 Answers

Yup it is possible to use different version of npm per project in a single system.

If you are using Mac or Linux based systems then you can user Node Version Manager (nvm).

For better idea about installation and usages of nvm you can take a look at their github ripo.

But if you are using windows then you have two alternative to nvm. NVM for Windows and nodist. You will find installation and usages instruction on the likes.

Hope it helps you. Thanks!!

like image 167
Sk Arif Avatar answered Nov 09 '22 09:11

Sk Arif


You can also use n created my TJ Holowaychuk. Which is simple flavour of node/iojs binary management, no subshells, no profile setup, no convoluted api, just simple.

like image 43
Tom34 Avatar answered Nov 09 '22 09:11

Tom34