当前位置:网站首页>Use Alibaba cloud NPM image acceleration

Use Alibaba cloud NPM image acceleration

2022-07-04 08:39:00 Baby Cabbage


1. What is? npm?
npm(node package manager) It's with NodeJS Package management tools installed together , Can solve NodeJS Many problems in code deployment , Common usage scenarios are as follows :
Allow users from NPM The server downloads third-party packages written by others to use locally .
Allow users from NPM The server downloads and installs command-line programs written by others to use locally .
Allows users to upload their own packages or command-line programs to NPM Servers for other people to use .
Thanks to the new edition of nodejs It's integrated npm, So before npm Also installed . You can also do it by typing "npm -v" To test the successful installation . The order is as follows , A version prompt appears to indicate that the installation was successful
Npm It can be understood as a command line tool , Its mission is to help you automatically install the development packages you depend on for the project .
composer yes php Package dependency management tool ,node.js The package management tool is npm. It can be understood in this way .
http://registry.npmjs.org yes npm The default development package Repository , stay npm In the command line tool, we can specify different warehouses .http://registry.npmjs.org It's the official warehouse . Other warehouses are regularly synchronized with the official warehouse . That is, if there is a certain delay in switching to other warehouse code packages . However, the download speed of switching to the domestic image source package will be very fast .npm Plug in installation process : from http://registry.npmjs.org Download the corresponding plug-in package ( The website server is located abroad , So download is often slow or abnormal )
Alibaba cloud official image station :https://developer.aliyun.com/...
2. see npm Source address settings :( Default official image address )
npm config get registry
https://registry.npmjs.org/
3. Configure Alibaba image address :( recommend , Fast enough , Fast synchronization frequency , Stable )
Alibaba cloud official image station :https://developer.aliyun.com/...
Npm Alibaba cloud address :
http://www.npmmirror.com
npm config set registry https://registry.npmmirror.com

Original Taobao npm Domain name resolution is about to stop , As in 《 TaoBao NPM The mirror station calls you to switch the new domain name 》 As predicted in :http://npm.taobao.org and http://registry.npm.taobao.org Will be in 2022.06.30 Officially offline and stopped DNS analysis . Domain name switching rules :
http://npm.taobao.org => http://npmmirror.com
http://registry.npm.taobao.org => http://registry.npmmirror.com

4. If you need to remove the image and restore to the official source , Please execute the following order :
npm config set registry https://registry.npmjs.org

原网站

版权声明
本文为[Baby Cabbage]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202141443401242.html