如何在Windows上安装libpng-dev?

问题描述 投票:11回答:2

我正在尝试为节点安装imagemin-pngquant模块:

https://www.npmjs.org/package/imagemin-pngquant

但是,当我运行命令时

npm install imagemin-pngquant --save-dev

我收到以下错误:

  warn : pngquant pre-build test failed
  info : compiling from source
 error : Error: pngquant failed to build, make sure that libpng-dev is installed
 at ChildProcess.exithandler (child_process.js:637:15)
 at ChildProcess.EventEmitter.emit (events.js:98:17)
 at maybeClose (child_process.js:735:16)
 at Socket.<anonymous> (child_process.js:948:11)
 at Socket.EventEmitter.emit (events.js:95:17)
 at Pipe.close (net.js:466:12)

如何安装pngquant所需的libpng-dev库?

png libpng node-modules
2个回答
4
投票

在Windows下安装gulp-imagemin时,我也有类似的问题,缺少libpng-dev。我发现libpng-dev在Windows中不存在,仅在MacOS和Linux中存在。这是我收到的错误消息:

enter > node lib/install.js
  ‼ Request to https://raw.github.com/imagemin/pngquant-bin/v3.0.0/vendor/win/pngquant.exe failed
  ‼ pngquant pre-build test failed
  i compiling from source
  × Error: pngquant failed to build, make sure that libpng-dev is installed
at ChildProcess.exithandler (child_process.js:744:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Socket.<anonymous> (child_process.js:1176:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:476:12)

所以,我尝试用]安装pngquant-bin

npm install --save-dev pngquant-bin

但是收到的错误信息大致相同。注意版本号3.0.0。然后我尝试像这样安装pngquant(不带-dev):

npm install --save-dev pngquant --msvs_version=2013

并且它成功安装了pngquant版本2.0.0。之后,我还可以安装gulp-imagemin。

我不确定2013年的图书馆版本是否在这里发挥了作用。


0
投票

使用Windows Power Shell,作为Admin

© www.soinside.com 2019 - 2024. All rights reserved.