A
A
Artem00712020-05-12 17:24:11
Node.js
Artem0071, 2020-05-12 17:24:11

How to switch Node version?

Brew installed

And there are 2 projects:
1) it works fine on the latest version of npm
2) it works fine only on [email protected]

I reinstalled the system, I install node:
brew install node

Everything is installed, I run npm run dev and the first project works, everything is fine
I go to the second project, I do npm run dev fails.

Ok, everything is clear already on the project, it does not work with the latest versions
. Install [email protected]:

brew install [email protected]
brew unlink node
brew link [email protected] --force --overwrite


here without --overwrite does not give:
Error: Could not symlink bin/npm
Target /usr/local/bin/npm
already exists. You may want to remove it:
  rm '/usr/local/bin/npm'

To force the link and overwrite all conflicting files:
  brew link --overwrite [email protected]

To list all files that would be deleted:
  brew link --overwrite --dry-run [email protected]


I go to the second project, do npm run dev - everything works, super

I go to the first project, do npm run dev - everything crashes

Again I rearrange to a fresh node:
brew unlink [email protected]
brew link node --force


I do npm:
zsh: command not found: npm
It's understandable, we deleted it there with the help of overwrite ..

Only reinstall helps.

In general, how can you quickly change node versions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander N++, 2020-05-12
@Artem0071

I use ` https://github.com/nvm-sh/nvm` at home on win and at work on linux
when we change versions and update packages if there are compiled addons.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question