zoukankan      html  css  js  c++  java
  • NPM镜像源查看和切换

    1、镜像源链接切换

    //查看镜像源使用状态:
    npm get registry
    //全局切换镜像源:
    npm config set registry http://registry.npm.taobao.org
    //全局切换官方镜像源
    npm config set registry http://www.npmjs.org

    2、nrm 管理镜像源

    nrm(npm registry manager )是npm的镜像源管理工具,因为上面的代码修改比较麻烦,还得记忆输入网址,这个nrm就比较方便切换镜像源了。

    下载 并全局安装nrm:

    npm install  nrm -g
    npm install -g nrm
    //-g表示全局安装

    查看可切换的镜像源:  (*表示正在使用的镜像源)       

    //显示当前可使用的镜像源列表
    nrm ls
    * npm -------- https://registry.npmjs.org/
      yarn ------- https://registry.yarnpkg.com/
      cnpm ------- http://r.cnpmjs.org/
      taobao ----- https://registry.npm.taobao.org/
      nj --------- https://registry.nodejitsu.com/
      npmMirror -- https://skimdb.npmjs.com/registry/
      edunpm ----- http://registry.enpmjs.org/

    3、切换镜像源

    切换为淘宝镜像源:

    nrm use taobao

    nrm ls报错

     【执行有错的,不一一模一样,但是都是这个原因导致的】

    则找到第四行找到`cli.js`17行,注释掉,

    //注释下列行
    const
    NRMRC = path.join(process.env.HOME, '.nrmrc'); //替换为 const NRMRC = path.join(process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], '.nrmrc');
  • 相关阅读:
    1136.NumberSteps
    1134.密码翻译
    1133.学分绩点
    1131.合唱队形
    1132.与7无关的数
    1130.日志排序
    Educational Codeforces Round 41 (Rated for Div. 2)
    Codeforces Round #378 (Div. 2) F
    Codeforces Round #290 (Div. 2)
    牛客网练习13 乌龟跑步
  • 原文地址:https://www.cnblogs.com/seeding/p/15219113.html
Copyright © 2011-2022 走看看