在 Ubuntu 20.04.2 LTS 上安装 node-gyp 重建失败

时间:2021-06-25 01:46:57

标签: node.js linux ubuntu npm

我正在尝试以可视化代码运行一个项目,但是每当我 npm install 导致此 npm-gyp 错误时,我已经安装了最新版本的 node、npm、python,我还安装了 python 2.7,但没有任何效果,我已经安装了必要的组件,甚至 pip。

user@ubuntu:~/testeGit/testeGitHub$ npm install
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

> sharp@0.18.4 install /home/user/testeGit/testeGitHub/node_modules/sharp
> node-gyp rebuild

ERROR: https://dl.bintray.com/lovell/sharp/libvips-8.5.5-linux-x64.tar.gz status code 403
gyp: Call to 'node -e "require('./binding').download_vips()"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/nodejs/node-gyp/lib/configure.js:355:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.8.0-59-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/user/testeGit/testeGitHub/node_modules/sharp
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN integradaBibliotecaV2@2.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.18.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.18.4 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!     /home/user/.npm/_logs/2021-06-25T01_34_27_616Z-debug.log

日志: Log_File_Here

1 个答案:

答案 0 :(得分:1)

node_modules/sharp 构建失败。您使用的操作系统显然没有为此节点包预先构建的二进制文件。

https://sharp.pixelplumbing.com/install

按照构建说明进行操作,特别是请参阅 libvips 部分。

您可能还想尝试更新您的软件包(您使用的是 0.18.4 而最新的是 0.28.3),如

https://dl.bintray.com/lovell/sharp/libvips-8.5.5-linux-x64.tar.gz

返回 403 Forbidden 错误,这意味着作者更改了链接,或者该主机不再托管它,或者可能未将其共享给公众。