我无法使用npm安装夏普

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了我无法使用npm安装夏普相关的知识,希望对你有一定的参考价值。

我无法使用sudo npm install sharp安装Sharp库。

终端输出:

sharp@0.23.1安装/ Users / kozakiewicz / node_modules / sharp(节点安装/ libvips和&节点安装/ dll复制和&预构建安装)|| (node-gyp重建&&节点安装/ dll复制)

info sharp Using cached /Users/kozakiewicz/.npm/_libvips/libvips-8.8.1-darwin-x64.tar.gz
ERR! sharp EACCES: permission denied, mkdir '/Users/kozakiewicz/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 '/Users/kozakiewicz/node_modules/sharp/build'
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kozakiewicz/node_modules/sharp
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/Users/kozakiewicz/package.json'
npm WARN gatsby-plugin-sass@2.1.14 requires a peer of gatsby@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-plugin-sass@2.1.14 requires a peer of node-sass@^4.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@7.3.1 requires a peer of webpack@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-plugin-sharp@2.2.27 requires a peer of gatsby@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-source-contentful@2.1.36 requires a peer of gatsby@^2.0.33 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-source-filesystem@2.1.22 requires a peer of gatsby@^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-transformer-sqip@2.1.25 requires a peer of gatsby@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-transformer-sqip@2.1.25 requires a peer of gatsby-transformer-sharp@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@7.1.0 requires a peer of webpack@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN kozakiewicz No description
npm WARN kozakiewicz No repository field.
npm WARN kozakiewicz No README data
npm WARN kozakiewicz No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.23.1 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.1 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!     /Users/kozakiewicz/.npm/_logs/2019-10-14T21_07_02_376Z-debug.log
答案

使用rm -rf node_modules删除所有依赖项,并删除/home/USER/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz,然后重试那应该解决。

以上是关于我无法使用npm安装夏普的主要内容,如果未能解决你的问题,请参考以下文章

无法安装 appium - npm ERR!代码 EAI_AGAIN

夏普打印机驱动下载

夏普包 Heroku 部署问题

我无法使用 npm 命令行安装任何东西

夏普卡普:'。'使用 printHex() 方法的字符而不是空格

调整大小时夏普图像库旋转图像?