美文网首页
npm 配置源, 安装 live-server

npm 配置源, 安装 live-server

作者: battleMonkey | 来源:发表于2019-03-29 01:20 被阅读0次

    写在前面: npm 配置

    作者:请叫我足下
    链接:https://www.jianshu.com/p/a2dc9400ff56

    • 首先安装 npm
    sudo apt install npm
    
    1. 查看npm源地址
    $ sudo npm config ls -l | grep registry
    

    结果:

    registry = "https://registry.npmjs.org/"
    
    1. 使用淘宝的npm源全局安装nrm包;
    $ sudo npm i nrm -g --registry=https://registry.npm.taobao.org/
    

    使用nrm ls查看当前所有可用的镜像源地址以及当前所使用的镜像源地址,*号标记的就是当前使用的npm源;

    $ nrm ls
    
      npm ---- https://registry.npmjs.org/
      cnpm --- http://r.cnpmjs.org/
    * taobao - https://registry.npm.taobao.org/
      nj ----- https://registry.nodejitsu.com/
      rednpm - http://registry.mirror.cqupt.edu.cn/
      npmMirror  https://skimdb.npmjs.com/registry/
      edunpm - http://registry.enpmjs.org/
    

    使用nrm use npmnrm use taobao切换不同的镜像源地址,例如你想切换npm源到npm官方源;

    $ nrm use npm
    
       Registry has been set to: https://registry.npmjs.org/
    
    $ nrm ls
    
    * npm ---- https://registry.npmjs.org/
      cnpm --- http://r.cnpmjs.org/
      taobao - https://registry.npm.taobao.org/
      nj ----- https://registry.nodejitsu.com/
      rednpm - http://registry.mirror.cqupt.edu.cn/
      npmMirror  https://skimdb.npmjs.com/registry/
      edunpm - http://registry.enpmjs.org/
    
    # 更新 npm 版本可执行如下命令
    $ sudo npm i npm -g
    

    安装 live-server警告 -> 暂时 没发现有什么影响

    image.png

    相关文章

      网友评论

          本文标题:npm 配置源, 安装 live-server

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