Home  >  Article  >  Web Front-end  >  How to use Taobao NPM source?

How to use Taobao NPM source?

零下一度
零下一度Original
2017-06-23 10:50:45954browse
As a foreign node warehouse installation tool, npm will naturally be interfered by the Great Wall Firewall. When domestic users install related resources, the installation will fail and the speed will be very slow. In order to solve the problem of npm installation, many npm mirror URLs have appeared in China. Taobao's npm mirror is relatively frequently used.
I know of three methods to use. The first is the two provided by Taobao npm:
1) You can use our customized cnpm (gzip compression support ) command line tool instead of the default npm:
$ npm install -g cnpm --registry=
2) Or you can directly add the npm parameter alias to a new command :
alias cnpm="npm --registry= \ --cache=$HOME/.npm/.cache/cnpm \ --disturl= \ --userconfig=$HOME/.cnpmrc" # Or alias it in .bashrc or .zshrc $ echo '\n#alias for cnpm\nalias cnpm="npm --registry= \ --cache=$HOME/.npm/.cache/cnpm \ --disturl= \ --userconfig =$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
3) Directly point the local npm warehouse to Taobao’s mirror address
npm config set registry
// After configuration, you can verify success through the following methods
npm config get registry
// or
npm info express
In fact, there is a fourth way, which is for temporary use,
npm --registry install express

The above is the detailed content of How to use Taobao NPM source?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn