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

How do I switch NPM versions? #484

Closed
typemismatch opened this issue Dec 29, 2017 · 11 comments
Closed

How do I switch NPM versions? #484

typemismatch opened this issue Dec 29, 2017 · 11 comments

Comments

@typemismatch
Copy link

Downgrade NPM version

I need NPM < 5.x for support with React Native, I can switch node just fine but I can't seem to downgrade NPM.

@shadowspawn
Copy link
Collaborator

shadowspawn commented Dec 29, 2017

n installs the version of npm bundled with node as part of the Node.js install. If you need a different version of npm, then downgrading (or upgrading) npm from the bundled npm version is a separate command. e.g.

npm install -g [email protected]

When you switch Nodes.js versions using n, you need to reinstall the desired npm version again.

2020 update: --preserve added in n v6.3.0 to preserve the version of npm when installing node.

@scottsword

This comment has been minimized.

@scottsword

This comment has been minimized.

@jeffora

This comment has been minimized.

@scottsword

This comment has been minimized.

@gsharp021

This comment has been minimized.

@omgaz
Copy link

omgaz commented Aug 31, 2018

remove n's version of npm, install latest npm globally using npm, symlink so everything plays nice (assuming global npm installs end up in ~/.npm-global)

rm -rf ~/n/bin/npm && npm i -g npm && ln -s ~/.npm-global/bin/npm ~/n/bin/npm && echo "You are now using NodeJS $(node -v) with NPM $(npm -v)"

@AndersonZacharyT

This comment has been minimized.

@shadowspawn

This comment has been minimized.

@shadowspawn
Copy link
Collaborator

shadowspawn commented Feb 24, 2020

--preserve added in n v6.3.0 to preserve the version of npm when installing node.

@deepakchandh

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants