https://blog.csdn.net/bbwangj/article/details/82253785

    安装cnpm,用cnpm替代npm
    npm install -g cnpm —registry=https://registry.npm.taobao.org

    方法一:源码包安装

    官网下载 centos下载最新版10.9 https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz

    mkdir /opt/software/ && cd /opt/software/

    tar -xvf node-v10.9.0-linux-x64.tar.xz

    mv node-v10.9.0-linux-x64 nodejs

    建立软连接,变为全局

    ①ln -s /opt/software/nodejs/bin/npm /usr/local/bin/

    ②ln -s /opt/software/nodejs/bin/node /usr/local/bin/

    查看安装的版本

    [root@localhost]# node -v
    v10.9.0
    [root@localhost]# npm -v