解决npm install各种报错的6种方案 Error: Command failed: cmd.exe autoreconf -ivf以及gifsicle pre-build test failed以及其他报错

报错示例: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/svgo@3.0.0: 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 tween@0.9.0: Use official tween.js package
npm WARN deprecated stable@0.1.8: 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 source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated uuid@3.4.0: 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 svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated core-js@2.6.12: 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>

问题解决

方案零:刷新刷新 DNS 解析缓存 还有 可以尝试重启电脑

G:\code_all\my_webpack_webgl2021-5-17-dev_01\three151-demo>ipconfig /flushdns

Windows IP 配置

已成功刷新 DNS 解析缓存。


方案一:使用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 webpack5@1.0.0: No license field
[1/4] Resolving packages...
warning tween@0.9.0: Use official tween.js package
⠈ yallist@^4.0.0

方案二:使用cnpm

npx cnpm install

方案三:修改配置host

  • ping一下 raw.githubusercontent.com

  • 查询 raw.githubusercontent.com 这个所对应的IP,如下面的例子

  • 打开本地C:\Windows\System32\drivers\etc\hosts文件

  • 添加


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



方案四:这种解决其他报错比较多-修改npm源

npm --registry https://registry.npm.taobao.org install

方案五: 清理缓存

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>

其他报错 Install fail! Error: EBUSY: resource busy or locked

方案零:关机重启,然后再 npm install

方案一:删除package-lock.json 和 node_modules,然后再 npm install

方案二:运行 npm cache clean --force 或者 npm cache verify ,然后再 npm install / cnpm install。

方案二:升级 npm, npm i -g npm,然后npm run dev / cnpm run dev

今天就写到这里啦~

  • 小伙伴们,( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ我们明天再见啦~~
  • 大家要天天开心哦

欢迎大家指出文章需要改正之处~
学无止境,合作共赢

在这里插入图片描述

欢迎路过的小哥哥小姐姐们提出更好的意见哇~~

posted @ 2023-04-24 23:46  糖~豆豆  阅读(5637)  评论(1编辑  收藏  举报
Live2D