Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For testing, change nPm version using NVM? #1842

Closed
ORESoftware opened this issue Jun 21, 2018 · 4 comments
Closed

For testing, change nPm version using NVM? #1842

ORESoftware opened this issue Jun 21, 2018 · 4 comments

Comments

@ORESoftware
Copy link

ORESoftware commented Jun 21, 2018

I was looking at this SO question/answer:
https://stackoverflow.com/questions/9755841/how-can-i-change-the-version-of-npm-using-nvm

Basically, for testing purposes, I am looking to test against different versions of Node.js and different versions of NPM.

I was naturally wondering if NVM could handle this?

One thing I was thinking of, was installing all your desired NPM versions in some folder in user $HOME, and then just symlinking those versions to the global space.

Something like this:

cd "$HOME/.npm_versions";
npm install npm@5
ln -s node_modules/npm "$(npm root -g)/npm"
ln -s node_modules/.bin/npm  "$(npm bin -g)/npm"

using npm link wouldn't work very well, because that re-runs installation and install hooks. But ln -s would work well, etc.

The above bash script is not exactly right but just trying to get the idea across.

@ORESoftware ORESoftware changed the title For testing, change npm version using NVM? For testing, change nPm version using NVM? Jun 21, 2018
@ORESoftware
Copy link
Author

@ljharb
Copy link
Member

ljharb commented Jun 21, 2018

nvm does not currently manage npm at all; npm install -g npm@whatever is the way you'll need to handle it for now.

Duplicate of #964.

@ljharb ljharb closed this as completed Jun 21, 2018
@ORESoftware

This comment has been minimized.

@ljharb
Copy link
Member

ljharb commented Jun 22, 2018

@ORESoftware that's why nvm install-latest-npm exists.

@nvm-sh nvm-sh locked as resolved and limited conversation to collaborators Jun 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants