Mirror usage method ( any of three methods can solve the problem. It is recommended to use the third one, write the configuration to death, and the configuration will still be there next time you use it ):
1. Pass the config command
npm config set registry https://registry.npm.taobao.org npm info underscore (If the above configuration is correct, this command will have a string response)
2. Command line specification
npm --registry https://registry.npm.taobao.org info underscore
3. Edit ~/.npmrc to add the following content
registry = https://registry.npm.taobao.org
Summarize
The above is a summary of three methods to solve the failure of nodejs installation package. I wonder if it will help you. If you have any questions, you can leave a message to communicate.