3

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
+ n@2.1.11
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
+ npm@6.1.0
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.

Morton
  • 5,380
  • 18
  • 63
  • 118
  • Please post text, not images of text. – jhpratt Jun 06 '18 at 04:22
  • Possible duplicate of [Upgrade NodeJS to the latest version on Mac os](https://stackoverflow.com/questions/11284634/upgrade-nodejs-to-the-latest-version-on-mac-os) – Cory Kleiser Jun 06 '18 at 04:22
  • @CoryKleiser the link's information is just what i try in my question. – Morton Jun 06 '18 at 04:23
  • Well I'm not sure what the problem is because your stack from the brew attemps say it's installed (10.3.0) so there must be something up with how you installed/configured it. – Cory Kleiser Jun 06 '18 at 04:27
  • 1
    Possible duplicate of [How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)](https://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x) – Patrick Roberts Jun 06 '18 at 05:00
  • Thanks, i will try your link's answer, btw why its so complicated with use latest node version... Why i can't remove node and install latest node just like Windows system... – Morton Jun 06 '18 at 05:53
  • 1
    Finally its working ! What i try is using `nvm`. It can install specify node version in my case. – Morton Jun 06 '18 at 06:20

1 Answers1

3
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

FrankM
  • 541
  • 3
  • 15