npm \ cnpm \ yarn \ tyarn questions about the source and agents

npm is a package manager. Node.js comes.

cnpm Ali is npm version, with Ali source.

another yarn package manager, comes not need additional means. Can be installed separately, can also be used npm installed.

tyarn is the yarn version of Ali, Ali with the source.

 

Installation cnpm

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

npm how to use, cnpm on how to use.

 

Installation tyarn

npm i yarn tyarn -g

how to use yarn, tyarn on how to use.

 

npm change Taobao source.

npm config set registry https://registry.npm.taobao.org

In return.

npm config set registry https://registry.npmjs.org

Now look at what the source.

npm config get registry

 

 

yarn empathy.

yarn config set registry https://registry.npmjs.org
yarn config set registry https://registry.npm.taobao.org
yarn config get registry

 

npm proxy settings

npm config set proxy=http://127.0.0.1:8087
npm config set https-proxy=http://127.0.0.1:8087

npm cancel Agent

npm config delete proxy
npm config delete https-proxy

 

yarn proxy settings

yarn config set proxy http://XXX
yarn config set https-proxy http://XXX

yarn cancel Agent

yarn config delete proxy
yarn config delete https-proxy

 

There is also a designated directory source exchange method.

    .Npmrc need to create a new directory yarn

registry=https://registry.npm.taobao.org

    Content above.

For individual difficult to download the library, can also set SASS_BINARY_SITE 解决。

Reference: https://segmentfault.com/a/1190000005921721

 

In summary, fitted rely difficulties, there are at least four ways.

  • Use cnpm / tyarn
  • Taobao replacement source / .npmrc set the source
  • Proxy settings
  • Set up SASS_BINARY_SITE


the above.

 

Guess you like

Origin www.cnblogs.com/foxcharon/p/11809367.html