CentOS7安装NodeJS

CentOS7安装NodeJS6.9

1.下载

wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz


2.解压

tar -xJf node-v6.9.2-linux-x64.tar.xz

clip_image002


3. 移到通用的软件安装目录 /opt/

mv node-v6.9.2-linux-x64 /opt/

clip_image004


4. 在系统命令中建立npm 和 node 命令的软连接

ln -s /opt/node-v6.9.2-linux-x64/bin/node /usr/local/bin/node

ln -s /opt/node-v6.9.2-linux-x64/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

clip_image006


5. 验证

node -v

npm -v

clip_image008


6. 安装Express

npm install -g express

clip_image010


7. 设置代理

npm config set registry "http://registry.npmjs.org/"

npm config set https-proxy http://username:pawword@server:port

npm config set proxy=http://192.168.1.1:8080

npm config set registry https://registry.npm.taobao.org

npm config delete proxy

npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/

npm config set msvs_version 2012 --global

posted @ 2018-08-25 21:01  ParamousGIS  阅读(178)  评论(0编辑  收藏  举报