Reputation: 21815
I installed two different versions of a node package:
npm install sails -g
npm install sails@beta -g
What could I use to use these versions according what is specified in package.json
in a directory basis?
Upvotes: 0
Views: 244
Reputation: 9045
First of all, when you are doing
npm install sails -g
npm install sails@beta -g
it installs the packages globally, and the second command will override the first. One of the main purposes of global installs is having the executable command (sails
in our case) available in the PATH
. And this command, basically, defines for which version of Sails you will generate the new application when you type sails new ...
.
Long story short, if you really need to be able to use two different versions of the package, you can install one of them locally and then provide the full path to the executable. Something like:
npm install sails -g
mkdir -p ~/tmp
cd ~/tmp
npm install sails@beta
cd ~/Sites
sails new thisWillBeAStableApp
../tmp/node_modules/.bin/sails new thisWillBeABetaApp
The generators are supposed to configure package.json
files accordingly.
Upvotes: 1