Reputation: 751
For a client's web project I work with two other developers. The frontend is built with quite a setup (gulp, foundation, bower, ...) and started a few years ago. They both use a (never updated)
combination of Node v6.12.2 and npm v5.6.0.
As I had Node v10.x on my machine and the first attempts of running npm install
after cloning the project failed, I'd like to use the exact same setup:
I setup nvm to use v6.12.2
$ \projectfolder nvm use v6.12.2
The Terminal then states:
Now using node v6.12.2 (npm v3.10.10)
How can I tell my setup to use [email protected] along with node v6.12.2? I tried npm install [email protected]
which then changes the used npm version, but also changes the used node version back.
I know nvm installs the respective npm version along with the node version. But is there a way to work with exactly this combination of versions the other developers use in my project?
Upvotes: 5
Views: 17351
Reputation: 2055
Find where your nvm is installed .eg:
Then you can explicitly call your desired npm version like:
your\path\..\AppData\Roaming\nvm\v12.10.0\npm -help
Upvotes: 1
Reputation: 2673
After switching node
versions with nvm use
(and confirming you switched with node --version
), you should globally update/downgrade npm
with:
npm install -g [email protected] // -g arg is important
Switch back to other node version and it should be using its own version. Also see this npm article about installing npm versions.
If you want to know why it is installed globally: run in the command line:
ls -l $(which npm)
It returns
/home/USER_NAME/.nvm/versions/node/vNODE_VERSION/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
It's a symlink to the global node_modules
folder of that specific node version.
Upvotes: 6