What if NPM install gets stuck?

Recently, many students came to me and asked me why I failed to install Java projects step by step according to your documents.

This is… What can I do (heart also love you)

npm install fail

The reason of his

Just like this kid’s shoes, even put up a ladder but still failed to install! This may have nothing to do with NPM itself. After confirming that he has a ladder, I will let him connect to the mobile network and then NPM install. Then what? A miracle! Ha, ha, ha

Success with ladder + mobile wifi + NPM install

Pit craters

Sometimes it’s not the NPM website itself that’s the problem. I had this problem once during the pandemic. Machines that used to be remotely accessible at work are now inaccessible at home. It’s the kind of direct access failure, not network instability. During the process, I pinged the IP address of the corresponding machine on my mobile phone and it turned out to be ok. During the epidemic, I connected to the server through the wifi of my mobile phone when I was working remotely. Although I called mobile to complain, from the perspective of the software industry, this problem could not be solved in one day or two. Because China Mobile’s broadband is starting, that’s why telecom is the big brother.

The friend in the screenshot has the same problem as me. Although you sometimes follow the document step by step, it has a lot to do with the environment after all. You can always find a way through one by one.

What if you don’t have a ladder?

First CNPM directly install the CNPM command and then use the CNPM command directly

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

The second uses proxies

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

Note that the installation of CNPM only inatsll when using CNPM other commands or using NPM may cause strange problems.

conclusion

A ladder is a good thing

No ladder. Look for the mirror

No ladder to find the mirror also failed to install the replacement network