錯誤記錄之:
Error: Command failed: C:\windows\system32\cmd.exe /s /c "./configure --disable-shared
- 錯誤關鍵詞:
cwebp-bin
,autoreconf -ivf
,pngquant
,libpng-dev
- 完整的錯誤信息有3條:
- Error: Command failed: C:\windows\system32\cmd.exe /s /c "./configure --disable-shared --prefix="D:\Project\vue-admin-beautiful-template\node_modules\cwebp-bin\vendor" --bindir="D:\Project\vue-admin-beautiful-template\node_modules\cwebp-bin\vendor""
- Error: Command failed: C:\windows\system32\cmd.exe /s /c "autoreconf -ivf"
'autoreconf' - Error: Command failed: C:\windows\system32\cmd.exe /s /c "./configure --with-system-zlib --prefix="D:\Project\vue-admin-beautiful-template\node_modules\optipng-bin\vendor" --bindir="D:\Project\vue-admin-beautiful-template\node_modules\optipng-bin\vendor""
- Error: pngquant failed to build, make sure that libpng-dev is installed
- 發生場景:安裝vue-admin-beautiful項目時遇到的
cnpm i
, npm install也試過,甚至fanqiang的方法都試過,還是報錯
定位問題
仔細看錯誤記錄會發現有一個提示,不過他是黃色的警告,並不會讓人注意,我把完整的記錄貼出來:
> cwebp-bin@5.1.0 postinstall D:\Project\vue-admin-beautiful-template\node_modules\cwebp-bin
> node lib/install.js
‼ getaddrinfo ENOENT raw.githubusercontent.com
‼ cwebp pre-build test failed
i compiling from source
× Error: Command failed: C:\windows\system32\cmd.exe /s /c "./configure --disable-shared --prefix="D:\Project\vue-admin-beautiful-template\node_modules\cwebp-bin\vendor" --bindir="D:\Project\vue-admin-beautiful-template\node_modules\cwebp-bin\vendor""
'.' �����ڲ����ⲿ���Ҳ���ǿ����еij���
�����������
at D:\Project\vue-admin-beautiful-template\node_modules\bin-build\node_modules\execa\index.js:231:11
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
> gifsicle@5.1.0 postinstall D:\Project\vue-admin-beautiful-template\node_modules\gifsicle
> node lib/install.js
‼ getaddrinfo ENOENT raw.githubusercontent.com
‼ gifsicle pre-build test failed
i compiling from source
× Error: Command failed: C:\windows\system32\cmd.exe /s /c "autoreconf -ivf"
'autoreconf' �����ڲ����ⲿ���Ҳ���ǿ����еij���
�����������
仔細瞧就發現了關鍵字raw.githubusercontent.com
,都是在連接這個地址的時候出現了問題,以前就被這個地址坑過,因為這個地址被牆了很久了,
解決辦法
找到問題所在,解決起來就容易得多了,直接找到可用的ip地址寫進host里面,這里剛好有一個,如果下面的ip地址不行,找到可用ip地址就好
199.232.28.133 raw.githubusercontent.com
覺得有用 ?喜歡就收藏,順便點個贊吧,你的支持是我最大的鼓勵!微信搜公眾號 [DX前端框架知識庫],發現更多Vue, React, Flutter, Uniapp, Nodejs, Html/Css等前端知識和實戰.
DX前端,分享前端框架知識庫,文章詳見:DX前端