0

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

OctaviaLo
  • 1,268
  • 2
  • 21
  • 46

4 Answers4

1

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.)

shadowspawn
  • 3,039
  • 22
  • 26
  • Thank you, this is the right diagnosis. Simply brew uninstall node and the terminal will run the one in the n folder. – OctaviaLo Sep 17 '22 at 03:54
0

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.

  • Nope.. doesn't work. Did you install the latest version prior to installing n? I installed the latest version first and then am now trying to change the active version with n. – OctaviaLo Sep 16 '22 at 09:39
-1

first - install it globally :

$ npm install -g n

then - run this code:

$ n 17.4.0
erff-on
  • 303
  • 3
  • 9
-1

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

https://nodejs.org/dist/

Tam Vo
  • 44
  • 2