Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Upgrade NodeJS to the latest version on Mac os

Upgrade NodeJS to the latest version on Mac os

Problem

I am currently using Nodejs v0.6.16 on mac os x 10.7.4. Now I want to upgrade it to the latest NodeJS v0.8.1. But after downloading and installing the latest pkg file from nodejs.org, I find the system is still using v0.6.16 instead of v0.8.1 when I typed "node -v" in a terminal. Is there any step that I have missed? Or should I thoroughly uninstall the old version before installing the latest one?

BTW, I know that nvm can help to manage the nodejs package

https://github.com/creationix/nvm/

Is there any means to upgrade the nodejs without using it?

I have googled this problem, but it seems to me that there is no very clear answer to this question for the latest NodeJS. Many thanks.

Problem courtesy of: afterglowlee

Solution

If you initially installed Node.js with Homebrew, run:

brew update
brew upgrade node
npm install -g npm

Or as a one-liner:

brew update && brew upgrade node && npm install -g npm

If you installed via a package, then download the latest version from nodejs.org. This is now the recommended way to install node (>4.0)

See Installing Node.js and updating npm.

Note: If you have npm --version >= 2.7.1, you can replace install (above) with update.

  • Homebrew: Remove npm caveat
  • npm: Fix npm update -g
Solution courtesy of: wprl

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Upgrade NodeJS to the latest version on Mac os

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×