Home >Web Front-end >JS Tutorial >Share an example of how to install NodeJS V8.0.0 on CentOS

Share an example of how to install NodeJS V8.0.0 on CentOS

零下一度
零下一度Original
2018-05-26 15:54:431558browse

This article mainly introduces the method of installing NodeJS V8.0.0 on CentOS . Friends who need it can refer to

Download nodejs

wget https://npm.taobao.org/mirrors/node/v8.0.0/node-v8.0.0-linux-x64.tar.xz

Decompression

tar -xvf node-v8.0.0-Linux-x64.tar.xz

Test whether the installation is successful

Enter the bin directory under the decompression directory and execute the ls command

cd node-v8.0.0-linux-x64/bin && ls

There is node Test with npm

./node -v

Installation successful

Now node and npm cannot be used globally, make a link

Method 1

ln -s /www/node-v8.0.0-linux-x64/bin/node /usr/local/bin/node 
ln -s /www/node-v8.0.0-linux-x64/bin/npm /usr/local/bin/npm

Method 2

[root@xxx ~]# vi .bashrc //通过vim对.bashrc文件编辑 此处为vim 打开 .bashrc 
export name=root 
export PATH=$PATH:/www/node-v8.0.0-linux-x64/bin/
[root@xxx ~] # source .bashrc //立即生效 
[root@xxx ~] # echo $PATH //如果输出中有刚才添加的路径,说明添加成功

You can execute node and npm commands in any directory

View environmentVariables echo $PATH

The above is the detailed content of Share an example of how to install NodeJS V8.0.0 on CentOS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn