gpt4 book ai didi

npm - Gatsby new 安装锐包失败并崩溃

转载 作者:行者123 更新时间:2023-12-01 22:32:18 25 4
gpt4 key购买 nike

我无法启动 gatsby 入门项目。 new 命令进程在初始化期间崩溃,并导致错误和不可编译的项目。

命令如下:

> gatsby new gatsby-test

以下过程启动,但在 npm install 期间尝试安装 Sharp 软件包时失败。

info Creating new site from git:
Cloning into 'gatsby-test'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 2309 (delta 4), reused 10 (delta 4), pack-reused 2299
Receiving objects: 100% (2309/2309), 12.62 MiB | 7.98 MiB/s, done.
Resolving deltas: 100% (1487/1487), done.
success Created starter directory layout
info Installing packages...

> sharp@0.23.2 install /home/developer/projects/gatsby-test/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
fs.js:114
throw err;
^

Error: EACCES: permission denied, copyfile '/tmp/1890-libvips-8.8.1-linux-x64.tar.gz' -> '/home/developer/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz'
at Object.copyFileSync (fs.js:1728:3)
at WriteStream.<anonymous> (/home/developer/projects/gatsby-test/node_modules/sharp/install/libvips.js:104:16)
at WriteStream.emit (events.js:198:13)
at lazyFs.close (internal/fs/streams.js:207:14)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)
make: Entering directory '/home/developer/projects/gatsby-test/node_modules/sharp/build'
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:25:0:
/usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
#include <glib-object.h>
^~~~~~~~~~~~~~~
compilation terminated.
sharp.target.mk:129: recipe for target 'Release/obj.target/sharp/src/common.o' failed
make: *** [Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/home/developer/projects/gatsby-test/node_modules/sharp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
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 4.15.0-70-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/developer/projects/gatsby-test/node_modules/sharp
gyp ERR! node -v v10.17.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.23.2 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.2 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/developer/.npm/_logs/2019-11-18T16_45_16_026Z-debug.log

ERROR

Command failed with exit code 1: npm install



Error: Command failed with exit code 1: npm install

- error.js:56 makeError
[lib]/[gatsby-cli]/[execa]/lib/error.js:56:11

- index.js:114 handlePromise
[lib]/[gatsby-cli]/[execa]/index.js:114:26

- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7

知道这是怎么回事吗?我过去看到 sharp 存在一些问题,但现在应该是一个已解决且已修复的问题。我在这里缺少什么?

最佳答案

您可以通过在终端中运行以下命令来解决此问题...

rm -rf /Users/{username}/.npm/_libvips

brew install vips

rm -rf node_modules

npm install

关于npm - Gatsby new 安装锐包失败并崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58919394/

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