Solve npm install stuck motionless little awkward

Problems encountered

npm install -g @angular/cli
复制代码

When installing angular cli tool, we found that the progress bar has been stuck not moving, I believe many of my friends have encountered. The reason should be the domestic network connection npm slow, and even a lot of things can not download and install. So how to solve this problem?

Scheme One: the mirror mounting cnpm

This is a more commonly used method, first of all I also used this method. cnpm installation method, with reference to http://npm.taobao.org/

npm install -g cnpm --registry=https://registry.npm.taobao.org
复制代码

Enter the above command cmd on it, and then enter

cnpm install -g @angular/cli
复制代码

With the latter operation does not use mirroring operation is the same. But I encountered during the subsequent use in a number of issues, some errors occurred after running ng eject, so give up the program, using the program two.

Option Two: Use a proxy registry

After the online access to some information, the decision to use a proxy way, the method is also very simple,

npm config set registry https://registry.npm.taobao.org
复制代码

Then follow the install commands or through npm operation, rather than cnpm. A little obsessive-compulsive disorder I still like npm install ...

Reproduced in: https: //juejin.im/post/5d0c3d9c6fb9a07ed740852b

Guess you like

Origin blog.csdn.net/weixin_34148340/article/details/93180603