Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade node version in mac?

Tags:

node.js

I want to upgrade my node version from v6.2.1 to v8.11.2 on mac. I have been looking for some solutions Upgrade NodeJS to the latest version on Mac os and tried it.

I tried:

sudo npm cache clean -f (force) clear you npm cache
sudo npm install -g n install "n" (this might take a while)
sudo n stable upgrade to lastest version

When I type node -v it still shows v6.2.1

motogod19de-MacBook-Pro:~ motogod19$ sudo npm cache clean -f
Password:
npm WARN using --force I sure hope you know what you are doing.
motogod19de-MacBook-Pro:~ motogod19$ npm install -g n
/Users/motogod19/.nvm/versions/node/v6.2.1/bin/n -> /Users/motogod19/.nvm/versions/node/v6.2.1/lib/node_modules/n/bin/n
+ [email protected]
added 1 package from 4 contributors in 0.894s
motogod19de-MacBook-Pro:~ motogod19$ sudo n stable

     install : node-v10.2.1
       mkdir : /usr/local/n/versions/node/10.2.1
       fetch : https://nodejs.org/dist/v10.2.1/node-v10.2.1-darwin-x64.tar.gz
######################################################################## 100.0%
   installed : v6.2.1

motogod19de-MacBook-Pro:~ motogod19$ node -v
v6.2.1

And then I tried:

brew update
brew upgrade node
npm install -g npm

It still shows v6.2.1 finally.

motogod19de-MacBook-Pro:~ motogod19$ node -v
v6.2.1
motogod19de-MacBook-Pro:~ motogod19$ brew upgrade node
Error: node 10.3.0 already installed
motogod19de-MacBook-Pro:~ motogod19$ npm install -g npm
/Users/motogod19/.nvm/versions/node/v6.2.1/bin/npm -> /Users/motogod19/.nvm/versions/node/v6.2.1/lib/node_modules/npm/bin/npm-cli.js
/Users/motogod19/.nvm/versions/node/v6.2.1/bin/npx -> /Users/motogod19/.nvm/versions/node/v6.2.1/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
updated 2 packages in 11.901s
motogod19de-MacBook-Pro:~ motogod19$ node -v
v6.2.1

They are not working in my case...

My mac version:

10.13.4

Does someone know what I should try? Any help would be appreciated. Thanks in advance.

like image 202
Morton Avatar asked Aug 05 '26 13:08

Morton


1 Answers

sudo npm cache clean -f
sudo npm install -g n
sudo n versionNumber (i.e 14.16.0)

I tried this and it is working properly

like image 91
user15521003 Avatar answered Aug 07 '26 07:08

user15521003



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!