Have you ever encountered strange problems when using npm and cnpm together? Have you ever encountered the situation where the cnpm installation package on the Alipay mini program is invalid? Are they really just switching a request source? I believe that many friends use cnpm for a simple purpose, that is, to download things faster, they will change the request source to https://registry.npm.taobao.org npm install -g cnpm --registry=https://registry.npm.taobao.org Then use cnpm instead of npm. Once you do this, the problems mentioned above will occur, but you may not be able to discover them for a while. cause I installed something using npm, and then found that all the previous ones had problems. I panicked because I was just installing it, so how could it modify the previous ones? So I looked at this problem carefully, but couldn't find the answer, so I asked the big guy. reasonLinGo's reply Because cnpm uses soft links by default, it will cause npm to update the previous cnpm package after installation, and then the previous cnpm import will be gg, so a lot of things will be gg. Then we can find that the reason lies in cnpm itself. If we don't use it, the problem will be solved. Then the easiest way is to use npm install <some parameters> --registry=https://registry.npm.taobao.org This is perfect, but it is also very troublesome. You can upgrade it with nrm Introduction to NPM: Description: NPM (Node Package Manager) is a package manager for NodeJS, used for node plug-in management (including installation, uninstallation, dependency management, etc.) 6. Use npm to uninstall the plugin: 7. Use npm to update the plugin: 8. Update all plugins: 9. View NPM help: NPM help 10. Check the installed plugins in the current directory: CNPM Introduction: Note: Because the Google installation plug-in is downloaded from a foreign server, it is greatly affected by the network and may have abnormalities. It would be fine if Google's server was in China, so our Taobao team, who is happy to share, did this. From the official website: "This is a complete npmjs.org mirror. You can use this instead of the official version (read-only). The synchronization frequency is currently once every 10 minutes to ensure synchronization with the official service as much as possible." A better waynpm install -g nrm nrm use cnpm Then you can happily use npm to quickly download. -- The story is not over yet -- At this time, what should I do if cnpm has already been used in the project? Method improvementcnpm i --by=npm That's it, cnpm and npm will not conflict, for example, cnpm i --by=npm react reason
cnpm portal This is the end of this article about the pitfalls of mixing npm and cnpm. For more information about mixing npm and cnpm, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Some notes on mysql self-join deduplication
>>: Complete steps to achieve high availability with nginx combined with keepalived
First look at the code and effect↓ <style> ...
centos7 switch boot kernel Note: If necessary, it...
1. Navigation: Unordered List vs. Other Label Ele...
This article example shares the specific code of ...
1. Requirements description For a certain element...
This article shares with you a special effect mes...
Study plans are easily interrupted and difficult ...
The computer system has been reinstalled, and the...
What is a Port? The ports we usually refer to are...
js realizes the special effect of clicking and dr...
How to display text overflow? What are your needs...
Table of contents Isolate Data Columns Prefix Ind...
Basic syntax: <input type="hidden" na...
Table of contents 1. What is componentization? 2....
Table of contents Development Environment Game en...