npm install Caton problem

When you run npm install command, often encounter Caton phenomenon causes the installation to fail. The reason is that the domestic npm slow network connection, there are a lot of things can not download and install. Install the following ways to solve this problem!

 (1) mounting the mirror

cnpm installation method, reference http://npm.taobao.org/, this method is more commonly used.

Use custom cnpm (gzip compression support) command-line tool instead of the default npm:

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

Installation Module

From registry.npm.taobao.org install all modules. When installing the module has not been found to install synchronization over, Taobao NPM will be automatically synchronized in the background and let you install it from the official NPM registry.npmjs.org. Under times when you install this module will be installed directly from Taobao NPM.

$ cnpm install [name]

Synchronization module

Direct sync command immediately by a synchronization module, the command line only cnpm have this feature:

$ cnpm sync connect

 

(2) use a proxy registry

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

Then follow the install commands or through npm operation, rather than cnpm.

 

Guess you like

Origin www.cnblogs.com/zsg88/p/12467957.html