Error report
Create a new Vue project, run npm install and report an error, the error message is as follows:
PS E:\temp\hello-vue> npm install
npm ERR! code E404
npm ERR! 404 Not Found - GET https://repo.huaweicloud.com/repository/npm/magic-string/-/magic-string-0.30.2.tgz
npm ERR! 404
npm ERR! 404 'magic-string@https://repo.huaweicloud.com/repository/npm/magic-string/-/magic-string-0.30.2.tgz' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Local\npm-cache\_logs\2023-08-16T13_53_59_157Z-debug-0.log
problem causes
It should be that Huawei's mirror warehouse cannot be accessed.
solution
Change setting
Replaced with Taobao's mirror warehouse.
You need to modify the registry property in the configuration file .npmrc
.
registry=https://registry.npm.taobao.org/
How to open configuration files
- Open the configuration file directly
The configuration file is in the following location by default:
C:\Users\username\.npmrc
Open the file and modify the warehouse properties. The indication is as follows:
- Another way to open the configuration file:
Enter the following command on the command line, and then automatically open the configuration file.
npm config edit
result
Then install and run the project, there will be no error. Able to run development and packaging.