Saturday, January 14, 2017

Installing Node.js v7.4.0 on Linux Mint 18.1 (Serena)

Had a little trouble with installing, so thought I'd share my solution.

First I downloaded and unzipped the file from here: https://nodejs.org/dist/v7.4.0/node-v7.4.0-linux-x64.tar.xz

I like to install apps I download into /opt, so:
    $ cd /opt

Copied the zip over:
    $ sudo cp ~/node-v7.4.0-linux-x64.tar.xz .

Extracted the file:
    $ sudo tar xvf node-v7.4.0-linux-x665.tar.xz

Add the bin/node and bin/npm to be in the path by using update-alternatives:
    $ sudo update-alternatives --install /usr/bin/node node /opt/node-v7.4.0-linux-x64/bin/node 1
    $ sudo update-alternatives --install /usr/bin/npm npm /opt/node-v7.4.0-linux-x64/bin/npm 1

Now I get the expected versions:
    $ npm --version
    4.0.5

    $ node --version
    v7.4.0

No comments:

Post a Comment