Problems encountered
npm install -g commitizen
When installing the commitizen tool, I found that the progress bar has been stuck. I believe many friends have encountered it. The reason should be that the domestic network connection npm speed is slow, and many things cannot be downloaded and installed. So how to solve this problem?
Method 1: Install cnpm mirror
This is a relatively common method, and I first used this method.
How to install cnpm, refer to/
npm install -g cnpm --registry=
Just enter the above command in cmd, and then use cnpm to install
cnpm install -g nodemon
The subsequent operations are similar to those without using mirrors.
Method 2: Use proxy registry
After checking some information online, I decided to use the agent method. The method is also very simple, that is,
npm config set registry
Then the subsequent install and other commands will still operate through npm instead of cnpm.
Postscript supplement:
There is a bug in npm install, you can install yarn instead.
step:
Yarn, React Native command line tools (react-native-cli)
Yarn is an alternative npm tool provided by Facebook to speed up the download of node modules. React Native's command line tools are used to perform tasks such as creating, initializing, updating projects, and running packaged services.
npm install -g yarn react-native-cli
After installing yarn, you must also set up the mirror source:
yarn config set registry --global yarn config set disturl /dist --global
If you encounter EACCES: permission denied permission error, you can try running the following command (limited to linux systems): sudo npm install -g yarn react-native-cli.
After installing yarn, you can use yarn instead of npm, for example, use yarn instead of npm install command, and use yarn add a third-party library name instead of npm install --save a third-party library name.
Notice:At present, npm5 (the latest version was 5.0.4 when it was published) has the problem that other libraries will be deleted when installing new libraries, causing the project to fail to run normally. Please try to use yarn instead of npm operation.
Reprint and reference
/WXF_Sir/article/details/112944559
Solve the problem that npm install is always stuck
/pijunqi/p/
Solve the little embarrassment of npm install being stuck
/wenbinjiang/p/
Summarize
This is the article about the problem of npm install always stuck. For more related content related to npm install, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!