zoukankan      html  css  js  c++  java
  • npm / yarn 配置镜像、使用方法

    npm 默认 registry:https://registry.npmjs.org/

     npm中文文档:https://www.npmjs.cn 

     淘宝 NPM 镜像:https://npm.taobao.org 

     CNPM:https://cnpmjs.org 

    永久使用:

      npm config set registry URL (URL 即为需要设置的镜像站点地址)

      npm config set registry https://registry.npm.taobao.org --global  (淘宝镜像)

      npm config set disturl https://npm.taobao.org/dist --global  (Node镜像)

      npm config get registry 返回 https://registry.npm.taobao.org 即设置成功

      npm config get disturl 返回 https://npm.taobao.org/dist 即设置成功

    临时使用:

      npm install [pkg] --registry=https://registry.npm.taobao.org

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

    使用 cnpm:

      npm install cnpm -g

      React Native 官网 搭建开发环境 不建议使用 cnpm

    npm 命令缩写:

      -v: --version

      -g: --global

      -reg: --registry

      -S: --save

      -D: --save-dev

    安装yarn:

    npm install -g yarn

    设置 yarn 镜像源:

    yarn config set registry https://registry.npm.taobao.org --global
    yarn config set disturl https://npm.taobao.org/dist --global

    yarn 使用方法:

    • Installing all the dependencies 安装依赖
      yarn
      yarn install
    • Adding a dependency 添加依赖
      yarn add [package]
      yarn add [package]@[version]
      yarn add [package]@[tag]
    • Adding a dependency to different categories of dependencies 添加依赖到不同依赖项中
      yarn add [package] --dev  # dev dependencies
      yarn add [package] --peer # peer dependencies
    • Upgrading a dependency 更新依赖
      yarn up [package]
      yarn up [package]@[version]
      yarn up [package]@[tag]
    • Removing a dependency 移除依赖
      yarn remove [package]
    • Upgrading Yarn itself 升级 yarn
      yarn set version latest
      yarn set version from sources
    • Accessing the list of commands 访问命令列表
      yarn help
    • Starting a new project 初始化项目
      yarn init
     
  • 相关阅读:
    @Value不能给静态变量直接赋值问题
    jmeter测试http请求
    SqlServer单步调试
    mysql锁住 Lock wait timeout exceeded; try restarting transaction
    django在model中添加字段报错
    django admin下拉列表不显示值,显示为object的处理
    (原创推荐文章)kerberos服务器端与客户端
    kafka安装与测试
    Linux shell判断文件和文件夹是否存在
    df -h 卡死 如何解决
  • 原文地址:https://www.cnblogs.com/jserhub/p/11362710.html
Copyright © 2011-2022 走看看