ubuntu cheap node.js

[The author personally tested and recommends the second method]

There are many articles on the Internet about compiling and installing Node.js from source, and I strongly recommend against this method. In most cases, the package maintainer has a very clear understanding of the software structure, and the developer does not need to compile the latest version of the source code from scratch.

The method below works for the latest versions of Ubuntu, Ubuntu 12.04 LTS, Ubuntu 12.10, Ubuntu 13.04, etc. It helps developers install Node.js on Ubuntu without compiling and installing from scratch. You can execute the following commands on the cloud host:

    # apt-get update 
    # apt-get install -y python-software-properties software-properties-common 
    # add-apt-repository ppa:chris-lea/node.js 
    # apt -get update 
    # apt-get install nodejs 

Once the command completes, the latest version of Node.js is installed, no worries. Once a new version of Node.js is released, you can upgrade directly from the package manager without having to compile and install it again from scratch.


【Method Two】

Install nvm:

   There is an easy way to install nvm:

$ wget -qO- https://raw.github.com/creationix/nvm/v0.25.0/install.sh | sh

This installation actually clones nvm into ~/.nvm. The scource added in ~/.bashrc and ~/.zshrc are both set up during the installation.

If your nvm version is a lower version, you can also checkout the new version installation in ~/.nvm/, and it will be updated automatically.


Install node:

After installing nvm, you can directly use nvm to install node;

First use nvm to view all existing node versions:

$ nvm ls-remote   

 Then select the version you want to install:

$ nvm install <version>

 If multiple versions are installed, you can use

nvm use <version>

to choose the version you want.


After installation, npm will also be automatically loaded


You can use nvm current to view the current node version, and node ls to view the local node.

Set the default version with the following command:

  $ nvm alias default<version>

 nvm installs npm when it installs npm.

After installation, you can check the version you have installed with node -v.


Install express:

   $ nvm install -g express-generator

 For other express commands, see the express tutorial.

Guess you like