Thursday, November 5, 2015

How to upgrade the NodeJS

Today I was trying to build a website in express. And I noticed that on my Macbook, My node version is one year old.

To check node in the machine

node --version

You might see something like
v0.10.28

Check the latest version of NodeJS to check, whether you need to upgrade the node or not.

https://nodejs.org/en/download/releases/


To upgrade Node through npm

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

Check Node version again

node -v

it should be as per the node stable version. In my case "v5.0.0

Check the global npm list
npm -g list 


You might see some errors as following when you check the global list

npm ERR! extraneous: asap@2.0.3 /usr/local/lib/node_modules/npm/node_modules/asap
npm ERR! invalid: fstream-ignore@0.0.7 /usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore
npm ERR! missing: minimatch@~0.2.0, required by fstream-ignore@0.0.7



To update outdated package, use following command
sudo npm outdated -g --depth=0









No comments:

Post a Comment