• cnpm安装和使用


    查看npm源地址:

    npm config get registry
    
    • 1

    npm官方源地址:

    https://registry.npmjs.org
    
    • 1

    淘宝镜像源地址:

    https://registry.npmmirror.com
    
    • 1

    1.临时使用

    npm --registry https://registry.npmmirror.com install express
    
    • 1

    2.持久使用(推荐)

    npm config set registry https://registry.npmmirror.com
    
    • 1

    配置后可通过下面方式来验证是否成功

    npm config get registry 或 npm info express
    
    • 1

    3.通过cnpm使用(推荐)

    npm install -g cnpm --registry=https://registry.npmmirror.com
    
    • 1

    4、使用cnpm
    cnpm install xxx
    5、升级cnpm淘宝镜像为最新版本

    npm install npm@latest -g cnpm --registry=https://registry.npmmirror.com
    
    • 1

    6、用npm命令使用淘宝镜像
    npm自身就默认代的镜像:http://registry.npmjs.org

    npm config set registry https://registry.npmmirror.com
    
    • 1

    如果用npm命令使用淘宝镜像,再次修改为npm的淘宝链接:

    npm config set registry https://registry.npmmirror.com
    
    • 1

    7、cnpm命令没反应
    1、cnpm -v、cnpm install等等cnpm命令执行了都只是跳到下一行就毫无反应。试了npm是没问题的

    2、上百度搜了下列三种方式尝试都还是不行
    设置环境变量。没用
    删除C盘用户目录下的.npmrc文件。也没有用
    执行npm config set registry https://registry.npmmirror.com还是没用

    3、就试着卸载cnpm重新安装试试,果然可以了
    卸载 npm uninstall -g cnpm --registry=https://registry.npmmirror.com
    注册 npm set registry https://registry.npmmirror.com
    解析 npm set disturl hhttps://registry.npmmirror.com/dist
    安装 npm install -g cnpm --registry=https://registry.npmmirror.com

  • 相关阅读:
    如何使用界面控件Telerik UI for WinForms开发步骤进度条?
    源码解析Java数组如何选择排序的算法
    【算法与数据结构】--目录
    Linux基础学习记录
    100 行 C++ 代码,教你快速实现视频画面动态分割!
    CNN经典架构
    Dubbo 2.6.1升级
    一些经常忽略的东西
    vue-cli vue3
    国产化服务器内网安装onlyoffice
  • 原文地址:https://blog.csdn.net/Lynn_yu/article/details/127418201