Tuesday, March 22, 2016

Updating nodejs without downloading it from the Node Js Site

Hello friends, I have started working with node.js and have found that installing the node js in a Linux based machine is pretty simple.

These are the following steps that can be followed in order to install node.js directly in Ubuntu.
  1. To install Node.js, open a terminal and type
    sudo apt-get install nodejs
  2. Then install the node package manager, npm:
    sudo apt-get install npm
  3. Create a symbolic link to node, as some apps uses nodsjs as a command
    sudo ln -s /usr/bin/nodejs /usr/bin/node
In order to get the version of the node you can use:
  1. node -v
  2. nodejs -v
    Since you already created a symbolic link for nodejs command in step 3 of previous section.
And this installs the node js in your machine. The main thing with this is that the version which is installed at this moment can be outdated or might be old, since the commands fetches the Node js that is available at the repository of Ubuntu, which may not be updated one.

So in order to update the Node.js version to the latest and stable version, instead of downloading it from the Node js website and building it from the scratch we can actually use the NPM, the node package manager itself to update the node pretty easily. For this I have found a very exiting blog here, but I am giving the commands that are used in order to update the node.
  1. sudo npm cache clean -f
  2. sudo npm install -g n
  3. sudo n stable
These commands will actually hit the node js repository in order to get the latest package of Node from there.

Although this will update the node pretty easily but there might be the case that you might get the old version of the node, so in that case please restart the machine and you might get the correct version of node by typing the command :
  • node -v
Hope this post helped you.
Thanks.

2 comments:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer Node js Training in Chennai . learn from or Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

    ReplyDelete
  2. The desire to play is normal, if you are passionate passion, then use it for the benefit of yourself. best online casino roulette I would play as if I live on the last day.

    ReplyDelete