无法安装夏普
Can't install Sharp
当 运行ning sudo npm i sharp --save
我得到以下错误:
> sharp@0.21.3 install /home/server/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /home/ronny/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, mkdir '/home/server/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/server/node_modules/sharp/build'
gyp ERR! System Linux 4.18.0-13-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/server/node_modules/sharp
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN server@1.0.0 No description
npm WARN server@1.0.0 No repository field.
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! /home/ronny/.npm/_logs/2019-01-28T20_33_46_476Z-debug.log
我在另一台机器上有相同的项目 运行ning,在那里,安装工作完美无缺。但是在我的另一台机器上(运行 Linux Ubuntu)我遇到了上面的错误。
我找不到针对此错误的任何解决方案。这就是我在这里寻求帮助的原因。
这对我有用。
npm install --unsafe-perm
请参考以下讨论
https://github.com/lovell/sharp/issues/1627#issuecomment-477109851
我已经通过降级 node version to 10.0.0
解决了这个错误。真的很管用!
运行 npx create-strapi-app my-project --quickstart on windows 并得到同样的错误,必须从 visual studio 安装用于桌面开发的 C++ 并且它有效.
删除 package-lock.json 和 node_modules
然后尝试安装软件包 npm install
对我有用。
所以首先错误说权限被拒绝。
使用
安装
sudo
当您在 sharp documentation 中使用 sudo
时!它说你必须使用
npm install --unsafe-perm
我会推荐:
- 转到
/home/ronny/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz
(在您的错误代码中)
- 删除文件:
libvips-8.7.0-linux-x64.tar.gz
- 在您的终端中键入:
npm install --unsafe-perm
(这将安装已删除的库)
npm install sharp
那我觉得我应该好好工作吧。这些步骤解决了我的问题,我遇到了同样的问题。
希望能帮助到你。谢谢。
对于Apple M1 brew install vips
然后npm install --unsafe-perm
如果它不能解决您的问题,请在此
中查找更多内容
- xcode-select --install
- brew install gcc
- brew reinstall vips
- brew info vips
- npm i
Node v13.14.0+的问题,问题会解决
npm install sharp@0.23.2
如果您使用的是 sharp 0.22.1,您应该将 Node 版本降级到 >=10.0.0
我的 Apple M1 遇到了同样的问题,我 运行 下一个命令:
- 我删除了node_modules
- 我删除了包-lock.json
- 运行:
brew install vips
- 运行:
npm install --unsafe-perm
而且有效
最简单的方法是:
brew uninstall vips
然后:
npm install
npm install --arch=x64 --platform=linux sharp
为我工作
取自:https://github.com/lovell/sharp/issues/2128#issuecomment-600232917
我正在使用 M1 mac
尝试使用 yarn 而不是 npm,它对我有用(docker,官方节点图像 16.x)
yarn add sharp
晚了,但我告诉你什么对我有用。如果您之前安装了任何与 sharp 完全相同的依赖项,请从您的 Package.json
文件中删除 dependency
然后 运行
npm install sharp
就我而言,我必须先安装 Python。之后,一切顺利。
Install Python here.
npm i sharp
npm ERR! code 1
npm ERR! gyp ERR! find Python
gyp ERR! stack at PythonFinder
当 运行ning sudo npm i sharp --save
我得到以下错误:
> sharp@0.21.3 install /home/server/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /home/ronny/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, mkdir '/home/server/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/server/node_modules/sharp/build'
gyp ERR! System Linux 4.18.0-13-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/server/node_modules/sharp
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN server@1.0.0 No description
npm WARN server@1.0.0 No repository field.
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! /home/ronny/.npm/_logs/2019-01-28T20_33_46_476Z-debug.log
我在另一台机器上有相同的项目 运行ning,在那里,安装工作完美无缺。但是在我的另一台机器上(运行 Linux Ubuntu)我遇到了上面的错误。
我找不到针对此错误的任何解决方案。这就是我在这里寻求帮助的原因。
这对我有用。
npm install --unsafe-perm
请参考以下讨论 https://github.com/lovell/sharp/issues/1627#issuecomment-477109851
我已经通过降级 node version to 10.0.0
解决了这个错误。真的很管用!
运行 npx create-strapi-app my-project --quickstart on windows 并得到同样的错误,必须从 visual studio 安装用于桌面开发的 C++ 并且它有效.
删除 package-lock.json 和 node_modules
然后尝试安装软件包 npm install
对我有用。
所以首先错误说权限被拒绝。
使用
安装
sudo
当您在 sharp documentation 中使用 sudo
时!它说你必须使用
npm install --unsafe-perm
我会推荐:
- 转到
/home/ronny/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz
(在您的错误代码中) - 删除文件:
libvips-8.7.0-linux-x64.tar.gz
- 在您的终端中键入:
npm install --unsafe-perm
(这将安装已删除的库) npm install sharp
那我觉得我应该好好工作吧。这些步骤解决了我的问题,我遇到了同样的问题。 希望能帮助到你。谢谢。
对于Apple M1 brew install vips
然后npm install --unsafe-perm
如果它不能解决您的问题,请在此
- xcode-select --install
- brew install gcc
- brew reinstall vips
- brew info vips
- npm i
Node v13.14.0+的问题,问题会解决
npm install sharp@0.23.2
如果您使用的是 sharp 0.22.1,您应该将 Node 版本降级到 >=10.0.0
我的 Apple M1 遇到了同样的问题,我 运行 下一个命令:
- 我删除了node_modules
- 我删除了包-lock.json
- 运行:
brew install vips
- 运行:
npm install --unsafe-perm
而且有效
最简单的方法是:
brew uninstall vips
然后:
npm install
npm install --arch=x64 --platform=linux sharp
为我工作
取自:https://github.com/lovell/sharp/issues/2128#issuecomment-600232917
我正在使用 M1 mac
尝试使用 yarn 而不是 npm,它对我有用(docker,官方节点图像 16.x)
yarn add sharp
晚了,但我告诉你什么对我有用。如果您之前安装了任何与 sharp 完全相同的依赖项,请从您的 Package.json
文件中删除 dependency
然后 运行
npm install sharp
就我而言,我必须先安装 Python。之后,一切顺利。 Install Python here.
npm i sharp
npm ERR! code 1
npm ERR! gyp ERR! find Python
gyp ERR! stack at PythonFinder