6 solutions to solve various errors reported by npm install
-
- Example of error reporting:
- Other errors: Install fail! Error: EBUSY: resource busy or locked
-
-
- Solution zero: shut down and restart, and then npm install
- Solution 1: Delete package-lock.json and node_modules, and then npm install
- Solution 2: Run npm cache clean --force or npm cache verify, and then npm install / cnpm install.
- Solution 2: Upgrade npm, npm i -g npm, then npm run dev / cnpm run dev
- I will write here today~
-
Example of error reporting:
Error: Command failed: C:\Windows\system32\cmd.exe /s /c “autoreconf -ivf” gifsicle pre-build test failed
PS G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo> npm install
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm WARN deprecated @types/[email protected]: This is a stub types definition. svgo provides its own type definitions, so you do not need this installed.
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm WARN deprecated [email protected]: Use official tween.js package
npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo\node_modules\imagemin-webpack-plugin\node_modules\gifsicle
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node lib/install.js
npm ERR! ‼ connect ETIMEDOUT 185.199.111.133:443
npm ERR! ‼ gifsicle pre-build test failed
npm ERR! i compiling from source
npm ERR! × Error: Command failed: C:\Windows\system32\cmd.exe /s /c "autoreconf -ivf"
npm ERR! 'autoreconf' �����ڲ����ⲿ���Ҳ���ǿ����еij���
npm ERR! ���������ļ���
npm ERR!
npm ERR!
npm ERR! at G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo\node_modules\bin-build\node_modules\execa\index.js:231:11
npm ERR! at runMicrotasks (<anonymous>)
npm ERR! at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR! at async Promise.all (index 0)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Local\npm-cache\_logs\2023-04-24T09_19_00_423Z-debug-0.log
PS G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo>
Solution zero: Refresh the DNS resolution cache and try to restart the computer
G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo>ipconfig /flushdns
Windows IP 配置
已成功刷新 DNS 解析缓存。
Solution 1: Use yarn
G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo>npx yarn install
yarn install v1.22.19
warning package.json: No license field
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning [email protected]: No license field
[1/4] Resolving packages...
warning [email protected]: Use official tween.js package
⠈ yallist@^4.0.0
Solution 2: Use cnpm
npx cnpm install
Solution 3: Modify the configuration host
-
Ping raw.githubusercontent.com
-
Query the IP corresponding to raw.githubusercontent.com, as in the following example
-
Open the local C:\Windows\System32\drivers\etc\hosts file
-
Add to
185.199.108.133 raw.githubusercontent.com
185.199.108.133 gist.githubusercontent.com
185.199.108.133 cloud.githubusercontent.com
185.199.108.133 camo.githubusercontent.com
185.199.108.133 avatars0.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars3.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.108.133 avatars5.githubusercontent.com
185.199.108.133 avatars6.githubusercontent.com
185.199.108.133 avatars7.githubusercontent.com
185.199.108.133 avatars8.githubusercontent.com
Solution 4: There are many other errors reported in this way - modify the npm source
npm --registry https://registry.npm.taobao.org install
Solution 5: Clear the cache
G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo>npm cache clean --force
npm WARN using --force Recommended protections disabled.
G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo>npm cache verify
Cache verified and compressed (~\AppData\Local\npm-cache\_cacache)
Content verified: 0 (0 bytes)
Index entries: 0
Finished in 0.007s
G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo>
Other errors: Install fail! Error: EBUSY: resource busy or locked
Solution zero: shut down and restart, and then npm install
Solution 1: Delete package-lock.json and node_modules, and then npm install
Solution 2: Run npm cache clean --force or npm cache verify, and then npm install / cnpm install.
Solution 2: Upgrade npm, npm i -g npm, then npm run dev / cnpm run dev
I will write here today~
- Friends, ( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ See you tomorrow~~
- Everyone be happy every day
Everyone is welcome to point out where the article needs to be corrected~
Learning is endless, cooperation is win-win
- Welcome the little brothers and sisters passing by to put forward better opinions~~