gpt4 book ai didi

node.js - 安装 sharp 时出现问题

转载 作者:太空宇宙 更新时间:2023-11-04 11:45:30 28 4
gpt4 key购买 nike

当我尝试安装 nodebb 并使用命令“nodebb setup”初始化它时,以及然后自动安装第三方包,一直报错,报错信息如下。

是的,它总是尖锐,我讨厌那样。

我不知道为什么没有权限,我是 root 角色。我尝试自己 mkdir,但 npm 将其删除,然后告诉我“权限被拒绝”,对不起?????

我尝试使用 npm install sharp --ignore-scripts 安装 sharp 并自行安装依赖项。通过这种方式我可以运行 nodebb 服务器,但是当我尝试从浏览器上传图像并锐化它时,nodebb 出现如下错误

这是安装时的一些错误信息:

[root@bbs NodeBB]# npm install sharp
> sharp@0.23.0 install /home/bbs/NodeBB/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /root/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, mkdir '/home/bbs/NodeBB/node_modules/sharp/vendor'
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/page/install for required dependencies
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/bbs/NodeBB/node_modules/sharp/build'
gyp ERR! System Linux 3.10.0-957.el7.x86_64
gyp ERR! command "/usr/share/node-v12.9.1-linux-x64/bin/node" "/usr/share/node-v12.9.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/bbs/NodeBB/node_modules/sharp
gyp ERR! node -v v12.9.1
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.23.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.23.0 install 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/2019-09-11T06_23_30_748Z-debug.log

这是上传图片时的一些错误信息:

Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp.node'
Require stack:
- /home/bbs/NodeBB/node_modules/sharp/lib/constructor.js
- /home/bbs/NodeBB/node_modules/sharp/lib/index.js
- /home/bbs/NodeBB/src/file.js
- /home/bbs/NodeBB/require-main.js
- /home/bbs/NodeBB/app.js

- Remove the "node_modules/sharp" directory, run "npm install" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
- Search for this error at https://github.com/lovell/sharp/issues

最佳答案

我解决了,但我不知道为什么

通过这个命令:sudo chown -R $(whoami) node_modules/

我一直用root,很强大

关于node.js - 安装 sharp 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57883590/

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