0

I am trying to install/ switch node version in fly using n since different build requires different version of node. n is able to download specified version but it is unable to installed to /usr/bin/node and still old version there.

05-Apr-2021 11:46:27       installed : v10.16.0 to /usr/local/bin/node
05-Apr-2021 11:46:27          active : v8.16.1 at /bin/node

when I run node --version command it returns the old version 8.16.1 apparently, n installed node to different location. is there a way to fix that? thank you in advance

Kero
  • 1,924
  • 5
  • 33
  • 53
  • You have two versions of node installed, and could either delete the old one, or modify your path. Try "n doctor" for clues, and see https://stackoverflow.com/questions/65657802/node-version-will-not-update-using-n – shadowspawn Apr 06 '21 at 08:44

1 Answers1

1

N does not install to /bin, so the binary's location changed.

tl;dr:

Reset $PATH: PATH="$PATH"

What?

On a *NIX system, there are many binary locations: /bin, /usr/bin, /usr/local/bin, or even /home/USER/.local/bin if configured.

Why?

All the binary folders make it easier to organize.

Why did n change the location?

To keep with standards, of course. /usr[/local]/bin is the traditional spot for package-installed binaries.

Why didn't my shell see the new binary?

Shells use a "hash table" so they don't need to look through the $PATH again and again- wait, what's $PATH?

What's PATH?

PATH is a :-separated list of locations to find binaries to execute. For example, mine looks like this: /usr/local/opt/coreutils/libexec/gnubin:/home/badboyhalocat/node_installs/bin:/home/badboyhalocat/.config/yarn/global/node_modules/.bin:/home/badboyhalocat/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

The shell uses this to look up where to find the code to run.

Fixing this

Just reset your PATH: PATH="$PATH"

0xLogN
  • 3,289
  • 1
  • 14
  • 35
  • thanks @logan it was issue with some symbolic link. n was install to /usr/local/bin but bamboo was looking at /usr/bin . link both solve problem – Kero Apr 06 '21 at 14:45