问题
I've been spending hours on this problem of my gatsby dev blog. I cloned it from my repository and ran npm install
, also with sudo privilege, but it failed. Could anyone tell me what's the issue?
Here's the error that I'm getting:
localhost@localhost:~/Desktop/devBlog$ sudo npm install
[sudo] password for hellRaiser:
npm WARN tarball tarball data for typeface-montserrat@0.0.54 (sha512-Typhap0PWT299+Va0G/8ZtycHMXrH4gBWKfiW977KEBx5rXUUCa70gvqLx1fdA0WAo6bhSAQmo8uc+QFAmjPww==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for typeface-merriweather@0.0.72 (sha512-gO0+fcZ1fTyKUsYY1ltYOOTI6FmBGeEdyIfeQg9NL8aInndk0feiJJVJsKHm/DiyYrnQEezraAQhz/KQoqMGtw==) seems to be corrupted. Trying one more time.
> sharp@0.21.3 install /home/hellRaiser/Desktop/devBlog/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
ERR! sharp EACCES: permission denied, mkdir '/root/.npm'
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 WARN EACCES current user ("hellRaiser") does not have permission to access the dev dir "/root/.cache/node-gyp/12.16.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/hellRaiser/Desktop/devBlog/node_modules/sharp/.node-gyp"
make: Entering directory '/home/hellRaiser/Desktop/localhost@localhost:~/Desktop/devBlog$ sudo npm install
[sudo] password for hellRaiser:
npm WARN tarball tarball data for typeface-montserrat@0.0.54 (sha512-Typhap0PWT299+Va0G/8ZtycHMXrH4gBWKfiW977KEBx5rXUUCa70gvqLx1fdA0WAo6bhSAQmo8uc+QFAmjPww==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for typeface-merriweather@0.0.72 (sha512-gO0+fcZ1fTyKUsYY1ltYOOTI6FmBGeEdyIfeQg9NL8aInndk0feiJJVJsKHm/DiyYrnQEezraAQhz/KQoqMGtw==) seems to be corrupted. Trying one more time.
> sharp@0.21.3 install /home/hellRaiser/Desktop/devBlog/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
ERR! sharp EACCES: permission denied, mkdir '/root/.npm'
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 WARN EACCES current user ("hellRaiser") does not have permission to access the dev dir "/root/.cache/node-gyp/12.16.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/hellRaiser/Desktop/devBlog/node_modules/sharp/.node-gyp"
make: Entering directory '/home/hellRaiser/Desktop/devBlog/node_modules/sharp/build'
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:25:10: fatal error: vips/vips8: No such file or directory
25 | #include <vips/vips8>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [sharp.target.mk:138: Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/home/hellRaiser/Desktop/devBlog/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/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.4.0-26-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/hellRaiser/Desktop/devBlog/node_modules/sharp
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.21.3 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.21.3 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/2020-05-02T08_52_17_386Z-debug.log
localhost@localhost:~/Desktop/devBlog$
devBlog/node_modules/sharp/build'
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:25:10: fatal error: vips/vips8: No such file or directory
25 | #include <vips/vips8>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [sharp.target.mk:138: Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/home/hellRaiser/Desktop/devBlog/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/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.4.0-26-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/hellRaiser/Desktop/devBlog/node_modules/sharp
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.21.3 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.21.3 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/2020-05-02T08_52_17_386Z-debug.log
localhost@localhost:~/Desktop/devBlog$
来源:https://stackoverflow.com/questions/61556816/npm-install-failed-gatsby-dev-blog