All we need is an easy explanation of the problem, so here it is.
I am using macOS Big Sur and want to update my Node. However, after downloading its file from the official website and completing its installation, my terminal still shows and uses my previous node version.
Does anyone know how can I overcome this issue?
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
I suggest using nvm. It’s much simpler and eradicates the headache of updating.
To do this, you can install nvm. https://github.com/nvm-sh/nvm#installing-and-updating
you will be pasting in the curl command
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Note: when this is finished running, you should see a line near the bottom which says something like
Copy and paste this and hit enter.
Then check to make sure you have nvm installed now
After, in the terminal, type:
nvm install node (you can also check your current version first with
Run it and then check node version again. It should be updated.
While you’re at it, you can also update npm.
npm install -g npm
This should do it. Let me know if there are any issues. Note: this can all be done in the -zsh shell, no reason to move back to bash.
The error displayed was
sudo: n: command not found, which hinted that the binary might have not been successfully installed on your system. You need to check the location of
n executable by using
$ which n
n with more verbose debug level may also provide you with better information for troubleshooting.
$ sudo npm install --loglevel verbose -g n
Among possible options to install Node.js on MacOS,
n was tested to be less error prone as you can read here. You should be on the right direction with the package manager choice.
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂