我正在运行npm install
,我收到以下错误:
> mozjpeg@5.0.0 postinstall /home/MyUser/public_html/node_modules/mozjpeg
> node lib/install.js
⚠ The `/home/MyUser/public_html/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✖ Error: autoreconf -fiv && ./configure --disable-shared --disable-dependency-tracking --with-jpeg8 --prefix="/home/MyUser/public_html/node_modules/mozjpeg/vendor" --bindir="/home/MyUser/public_html/node_modules/mozjpeg/vendor" --libdir="/home/MyUser/public_html/node_modules/mozjpeg/vendor" && make -j4 && make install -j4
Command failed: ./configure --disable-shared --disable-dependency-tracking --with-jpeg8 --prefix="/home/MyUser/public_html/node_modules/mozjpeg/vendor" --bindir="/home/MyUser/public_html/node_modules/mozjpeg/vendor" --libdir="/home/MyUser/public_html/node_modules/mozjpeg/vendor"
/bin/sh: ./configure: Permission denied
at ChildProcess.exithandler (child_process.js:199:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Socket.<anonymous> (internal/child_process.js:351:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
> optipng-bin@3.1.4 postinstall /home/MyUser/public_html/node_modules/optipng-bin
> node lib/install.js
✔ optipng pre-build test passed successfully
> pngquant-bin@4.0.0 postinstall /home/MyUser/public_html/node_modules/pngquant-bin
> node lib/install.js
⚠ The `/home/MyUser/public_html/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 (/home/MyUser/public_html/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
at process._tickCallback (internal/process/next_tick.js:109:7)
这似乎缺乏权限,但我不明白为什么。如果我以root身份运行相同的命令,一切正常。我缺少哪些权限,以及如何解决这个问题?
谢谢。
答案 0 :(得分:0)
xubuntu 17.10上的问题同样如此,我所做的是安装libpng-dev
sudo apt-get install libpng-dev
然后再次运行npm install
。这解决了我的问题