使用npm安装错误:pngquant-bin

5
我安装了npm,一切运作正常直到出现这个错误。我尝试找出是什么原因导致了这个问题,但并没有成功。在安装后,我试图运行“npm run dev”,但也出现了错误。我猜测这可能是由于整个npm安装的问题。我还尝试安装模块pngquant-bin,但也没能成功。
如果您知道解决方法或者以前也遇到过这个问题,请帮助我解决。我看到其他关于此问题的问题,但却没有任何回复。请救救我。

pngquant-bin@4.0.0 postinstall /var/www/html/futebit/node_modules/pngquant-bin node lib/install.js

   The `/var/www/html/futebit/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
   pngquant pre-build test failed
   compiling from source
   pngquant pre-build test passed successfully
   Error: pngquant failed to build, make sure that libpng-dev is installed
    at Promise.all.then.arr (/var/www/html/futebit/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pngquant-bin@4.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pngquant-bin@4.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-07-16T14_17_27_195Z-debug.log
3个回答

3

0
错误提示为“请确保已安装libpng-dev”。这意味着您可能缺少该软件包。
在Debian/Ubuntu上,您可以使用“sudo apt-get install libpng-dev”命令进行修复。对我来说起作用了。

这并没有提供问题的答案。如果要批评或请求作者澄清,请在他们的帖子下留言。-【来自审查】 - Jean-François Fabre
好的,我已经更新了答案,希望现在符合规则。 - Mr. Goferito

0

看起来你正在尝试使用预编译的二进制文件pngquant-bin,但由于操作系统中使用的不兼容库而失败,所以有两种使用方法:

  1. 安装系统范围内的 - pngquant 包,除了节点包

  2. 如果您使用的是旧操作系统,请尝试升级库,然后再次安装节点包

  3. 如果您拥有最新的操作系统,请尝试将节点包升级到最新版本。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接