Linux installation of Nodejs three methods

  

nodejs installation usually has two ways, many people have used the compiled files to install nodejs when there are a lot of problems, the following small series will introduce you to Linux installation nodejs The three methods that interested friends can come to understand.

First go to the official website to download the code, here must pay attention to the installation of two kinds, one is the Source Code source code, one is the compiled file. I just follow the installation method of the online source code to operate the compiled file, and the result has been pitted for a long time.

Be careful about what files you downloaded! ! ! The corresponding installation method is different.

(a) the compiled file

It simply is unpacked, already node and npm, if you go to the corresponding file execute command lines in the bin folder There is no problem at all, but it is not global, so setting this to global is fine.

cd node-v0.10.28-linux-x64/bin

ls

. /node -v

This is all right, the node folder is placed specifically, what name is what you decide. Then set the global:

ln -s /home/kun/mysofltware/node-v0.10.28-linux-x64/bin/node /usr/local/bin/node

ln -s /home/kun/mysofltware/node-v0.10.28-linux-x64/bin/npm /usr/local/bin/npm

Here /home/kun/mysofltware/this path is your own, Where do you extract the node file?

(2) Compiled by source code

This way, the file you downloaded is Source code, which is more troublesome.

# tar xvf node-v0.10.28.tar.gz

# cd node-v0.10.28

# . /configure

# make

# make install

# cp /usr/local/bin/node /usr/sbin/

View the current installation Node version

# node -v

v0.10.28

(3) apt-get

There is also a shell prompt apt-get Way, strongly not recommended.

sudo apt-get install nodejs

sudo apt-get install npm

The above is the Linux installation of Nodejs method, three methods can install Nodejs, use the source code Installation is the easiest way, and the latter two are more troublesome, not very recommended.

Copyright © Windows knowledge All Rights Reserved