美文网首页
Ubuntu/Centos 安装nodejs和npm

Ubuntu/Centos 安装nodejs和npm

作者: JoJo_wen | 来源:发表于2017-11-28 23:45 被阅读0次

    Ubuntu

    1. update
     sudo apt-get  update    
    
    1. install nodejs
    sudo apt-get  install  nodejs
    

    using node -v to check whether install successfully or not.

    1. install npm
    sudo apt-get  install  npm
    

    using npm -v to check.


    if you not excute 1. command, you will get this error when you install npm. (just run apt-get update to solve it. )

    Do you want to continue? [Y/n] y
    Err:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main i386 libssl-dev i386 1.0.2g-1ubuntu4.8
      404  Not Found
    Err:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main i386 libssl-doc all 1.0.2g-1ubuntu4.8
      404  Not Found
    Unable to correct missing packages.
    E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/o/openssl/libssl-dev_1.0.2g-1ubuntu4.8_i386.deb  404  Not Found
    
    E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/o/openssl/libssl-doc_1.0.2g-1ubuntu4.8_all.deb  404  Not Found
    
    E: Aborting install.
    

    Centos

    yum -y install nodejs npm --enablerepo=epel
    

    Sometimes, you may find npm slow, try cnpm:

    npm install -g cnpm --registry=https://registry.npm.taobao.org
    

    相关文章

      网友评论

          本文标题:Ubuntu/Centos 安装nodejs和npm

          本文链接:https://www.haomeiwen.com/subject/oqpybxtx.html