centos安装nodejs

下载安装包

 

mkdir -p /usr/local/lib/nodejs && cd /usr/local/lib/nodejs

wget https://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-x64.tar.xz

xz -d node-v12.16.2-linux-x64.tar.xz

tar -xvf node-v12.16.2-linux-x64.tar

 

vi ~/.bash_profile

添加:

NODEJS_VERSION=v12.16.2
DISTRO=linux-x64
PATH=$PATH:/usr/local/lib/nodejs/node-$NODEJS_VERSION-$DISTRO/bin
export PATH

 

执行:node -v

# node -v
v12.16.2

执行:npm version

#npm version
{
  npm: '6.14.4',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '36.0',
  http_parser: '2.9.3',
  icu: '65.1',
  llhttp: '2.0.4',
  modules: '72',
  napi: '5',
  nghttp2: '1.40.0',
  node: '12.16.2',
  openssl: '1.1.1e',
  tz: '2019c',
  unicode: '12.1',
  uv: '1.34.2',
  v8: '7.8.279.23-node.34',
  zlib: '1.2.11'
}

  安装完成!

 

posted on 2020-04-28 17:17  哼着歌啦啦啦  阅读(396)  评论(0编辑  收藏  举报