How to downgrade Node version with n

2.7k Views Asked by At

I installed the latest node version 18.9.0 with brew. The I installed n with npm n. I can't switch the active version from 18.9.0 to 17.4.0 using n. I am not keen on using nvm, is there a way to do it with n?

I installed the latest version (18.9.0) first and then installed n globally and then now am trying to change the version with n, but I cannot seem to change the active version to a the lower one installed with n.

After installing n globally, I sudo n 17.4.0 but it does not change the active version.

enter image description here

4

There are 4 best solutions below

1
shadowspawn On BEST ANSWER

The trace statements are showing that you have two copies of node installed. The one installed by n (to /usr/local/bin/node) is later in your PATH. The "active" version was installed by homebrew.

You could uninstall the homebrew version, or modify your PATH.

(If you run n doctor this problem will be detected and explained.)

1
Xavier Xanthopoulos On

Since you have said using

$ n 17.4.0

is not working for you, maybe you could try using

$ n

And then pick the version you want using the arrow keys? That seems to work for me.

0
erff-on On

first - install it globally :

$ npm install -g n

then - run this code:

$ n 17.4.0
0
Tam Vo On

Nodejs.org has previous releases versions in their distribution directory. Find the node version you need and install it.

https://nodejs.org/dist/