gpt4 book ai didi

node.js - 当我尝试在 cPanel 上安装 Laravel 时出现 pngquant 错误

转载 作者:太空宇宙 更新时间:2023-11-04 01:31:17 24 4
gpt4 key购买 nike

我对 cPanel 缺乏经验,但我需要在 cpanel 上设置 Laravel 应用程序。我真的很努力解决这个问题。

以下是我正在采取的步骤:

  1. Git checkout 存储库
  2. 设置 .env
  3. Composer 安装
  4. Composer 更新
  5. chmod -R 775 存储和 chmod 775 引导/缓存
  6. npm install -g npm Bower yarn
  7. yarn 安装
  8. 凉亭安装
  9. npm 运行开发
  10. php artisan migrate:fresh --seed

(所有步骤的原因是因为我正在设置一个我购买的主题,该主题在除 cPanel 之外的任何地方都适用。)

我遇到的问题是当我尝试安装 npm 时。

当我运行 npm install 时,出现以下错误:

> pngquant-bin@3.1.1 postinstall /public_html/src/node_modules/pngquant-bin
> node lib/install.js

⚠ The `/public_html/src/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
⚠ pngquant pre-build test failed
ℹ compiling from source
✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:189:13)
at maybeClose (internal/child_process.js:970:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

我尝试了各种资源:

https://github.com/imagemin/pngquant-bin/issues/78

https://github.com/papandreou/node-pngquant/issues/14

我可以告诉你 pngquant 已安装(直接从 git 和 npm 安装它进行尝试)仍然是同样的错误。

libpng-dev 已安装(我认为):

识别-列表格式| grep PNG

  JNG* PNG       rw-   JPEG Network Graphics
MNG* PNG rw+ Multiple-image Network Graphics (libpng 1.2.46,1.2.49)
PNG* PNG rw- Portable Network Graphics (libpng 1.2.46,1.2.49)
See http://www.libpng.org/ for details about the PNG format.
PNG24* PNG rw- opaque 24-bit RGB (zlib 1.2.3)
PNG32* PNG rw- opaque or transparent 32-bit RGBA
PNG8* PNG rw- 8-bit indexed with optional binary transparency

我已经尝试过这个:

npm install imagemin-pngquant@5.0.1 --save
npm install pngquant-bin@3.1.1

仍然出现同样的错误

[~/public_html/src]# npm install pngquant-bin@3.1.1 --save

> pngquant-bin@3.1.1 postinstall /public_html/src/node_modules/pngquant-bin
> node lib/install.js

⚠ The `/public_html/src/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
⚠ pngquant pre-build test failed
ℹ compiling from source
✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:189:13)
at maybeClose (internal/child_process.js:970:16)
at Socket.stream.socket.on (internal/child_process.js:389:11)
at Socket.emit (events.js:189:13)
at Pipe._handle.close (net.js:597:12)

我也尝试将其添加到 package.json

"resolutions": {
"image-webpack-loader/imagemin-pngquant": "5.0.1"
}

我的 Node 和 npm 版本是:

Node -v v10.15.3

npm -v 6.9.0

最后,这是我的 bin 文件夹的样子:

[~/bin]# ls
./ bower@ node_modules/ npm-cli.js@ pngquant@ yarn.lock
../ node* npm@ npx@ yarn@ yarnpkg@

对我来说,似乎 pngquant 安装正确,但由于某种原因它没有找到 libpng-dev?想法?帮助?!请帮忙。

最佳答案

首先确保你确实有 libpng-dev 而不仅仅是 libpng

dpkg -l libpng-dev

如果没有东西被退回,那么你就没有它,所以安装它,你还需要必需品包,所以确保你也有:

sudo apt install build-essential libpng-dev

执行此操作后,您很可能需要删除node_modules文件夹

rm -rf node_modules

然后再次运行npm install

关于node.js - 当我尝试在 cPanel 上安装 Laravel 时出现 pngquant 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56043544/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com