waw*_*los 21 debian npm pngquant
我的npm update
命令出现以下错误:
> pngquant-bin@4.0.0 postinstall /var/www/pp/20180315202846/node_modules/pngquant-bin
> node lib/install.js
? The `/var/www/pp/20180315202846/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
? RequestError: pngquant failed to build, make sure that libpng-dev is installed
at ClientRequest.req.once.err (/var/www/pp/20180315202846/node_modules/pngquant-bin/node_modules/got/index.js:111:21)
at Object.onceWrapper (events.js:272:13)
at ClientRequest.emit (events.js:180:13)
at ClientRequest.onConnect (/var/www/pp/20180315202846/node_modules/pngquant-bin/node_modules/tunnel-agent/index.js:168:23)
at Object.onceWrapper (events.js:272:13)
at ClientRequest.emit (events.js:180:13)
at Socket.socketOnData (_http_client.js:476:11)
at Socket.emit (events.js:180:13)
at addChunk (_stream_readable.js:269:12)
at readableAddChunk (_stream_readable.js:256:11)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: 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.
Run Code Online (Sandbox Code Playgroud)
我已经做了:
apt-get install libpng-dev
Run Code Online (Sandbox Code Playgroud)
但我仍然得到这个错误.有任何想法吗?(我的发行版是Debian 9.2)
小智 25
对于Ubuntu,您需要运行:
wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
&& sudo dpkg -i /tmp/libpng12.deb \
&& rm /tmp/libpng12.deb
Run Code Online (Sandbox Code Playgroud)
Tom*_*rre 10
也许你会在原始问题上找到一些帮助.
https://github.com/imagemin/pngquant-bin/issues/78
他是一个建议修复:(复制/粘贴来自:https://github.com/imagemin/pngquant-bin/issues/78#issuecomment-374192838)正如@ velu76和@ sory19所说,我按照他们的方法:
'sudo apt-get install libpng-dev''npm install -g pngquant-bin'
由于我已经在我的repo/project文件夹中'npm install',然后我运行了'sudo rm -rf node_modules'
然后,仍然在我的资料库/项目文件夹'npm install --no-bin-links'
它现在可以正常工作.
实际上,我不知道它是否只是一个临时修复,但我现在可以工作了.
小智 3
太长了;
\n对于 docker 镜像,使用 node:latest 而不是 node:alpine
\xe2\x80\x94
\n嗨,我正在使用 docker image node:alpine,昨天它也崩溃了。似乎是 laravel-mix 需要的某些外部包的问题。我在节点:alpine节点:8.10.0-alpine节点:8.8.1-alpine上进行了测试,没有任何效果。我测试了 laravel-mix 0.11.4 和 0.12.1 和 1.0 没有任何效果。但是当我从node:alpine切换到node:latest时,它就起作用了。希望这可以帮助