Home > Web Front-end > JS Tutorial > body text

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

零下一度
Release: 2018-05-26 15:54:43
Original
1515 people have browsed it

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
Copy after login

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
Copy after login

There is node Test with npm

./node -v
Copy after login

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
Copy after login

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 //如果输出中有刚才添加的路径,说明添加成功
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!