0
点赞
收藏
分享

微信扫一扫

Error: pngquant failed to build, make sure that libpng-dev is installed

雪域迷影 2022-01-04 阅读 283
npm前端

遇到了一个很难搞的报错

新同事遇到的,最开始的体现是这样的
在这里插入图片描述
看到这个报错是很懵的,进入到对应的依赖目录下,发现pngquant.exe不存在

认为是依赖装得有问题,各种卸载重装,重新配置淘宝镜像,遇到新报错
Error: pngquant failed to build, make sure that libpng-dev is installed
在这里插入图片描述

› pngquant-bin@^5.0.0 run "node lib/install.js", root: "C:\\Users\\tophc\\Documents\\project\\code\\node_modules\\_pngquant-bin@5.0.2@pngquant-bin"
  ‼ Command failed: C:\Users\tophc\Documents\project\code\node_modules\_pngquant-bin@5.0.2@pngquant-bin\vendor\pngquant.exe --version


  ‼ pngquant pre-build test failed
  i compiling from source
  × Error: pngquant failed to build, make sure that libpng-dev is installed
    at C:\Users\tophc\Documents\project\code\node_modules\_execa@0.7.0@execa\index.js:231:11
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)
[npminstall:runscript:error] image-webpack-loader@5.1.0 › imagemin-pngquant@6.0.1 › pngquant-bin@^5.0.0 scripts.postinstall run "node lib/install.js" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c node lib/install.js" error, exit code 1
    at ChildProcess.<anonymous> (C:\Users\tophc\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:96:21)
    at ChildProcess.emit (events.js:311:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
  name: 'RunScriptError',
  stdio: [Object],
  exitcode: 1
}
× Install fail! RunScriptError: post install error, please remove node_modules before retry!

关键提示:pngquant failed to build, make sure that libpng-dev is installed
我是很懵的,搜了一圈也没找到类似的问题,查到libpng-dev是在linux下安装的

从pngquant入手,这种情况其实就是系统环境缺了一个 dll文件, 导致 去安装 pngquant插件的时候报错


解决方法:
-> 前往 https://pngquant.org/ 下载pngquant库
在这里插入图片描述
->解压压缩包至C:\Windows\System32目录下

->管理员身份运行pngquant.exe
在这里插入图片描述

再安装就不会报错了

举报

相关推荐

0 条评论