如何安装“gatsby-plugin-sharp”插件

问题描述 投票:0回答:2

当我运行命令gatsby develop启动开发服务器时,我收到以下错误消息:

成功打开并验证gatsby-configs - 0.006 s错误UNHANDLED REJECTION

错误:无法找到插件“gatsby-plugin-sharp”。也许你需要安装它的包?

  • load.js:107 resolvePlugin [gatsby-site] / [gatsby] /dist/bootstrap/load-plugins/load.js:107:11
  • load.js:119 processPlugin [gatsby-site] / [gatsby] /dist/bootstrap/load-plugins/load.js:119:20
  • load.js:169 config.plugins.forEach.plugin [gatsby-site] / [gatsby] /dist/bootstrap/load-plugins/load.js:169:20
  • Array.forEach
  • load.js:168 module.exports [gatsby-site] / [gatsby] /dist/bootstrap/load-plugins/load.js:168:20
  • index.js:56 [gatsby-site] / [gatsby] /dist/bootstrap/load-plugins/index.js:56:21
  • generator.next
  • 新的承诺
  • index.js:96 [gatsby-site] / [gatsby] /dist/bootstrap/load-plugins/index.js:96:17
  • index.js:128 [gatsby-site] / [gatsby] /dist/bootstrap/index.js:128:36
  • generator.next

当我尝试安装它时,它显示以下消息:

 npm install --save gatsby-plugin-sharp

[email protected]安装D:\ gatsby-site \ node_modules \ sharp(节点安装/ libvips && node install / dll-copy && prebuild-install)|| (node-gyp rebuild && node install / dll-copy)

info sharp下载https://github.com/lovell/sharp-libvips/releases/download/v8.7.0/libvips-8.7.0-win32-x64.tar.gz D:\ gatsby-site \ node_modules \ sharp \ install \ libvips.js:78 throw err;

D:\ gatsby-site \ node_modules \ sharp>如果未定义npm_config_node_gyp(节点“C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ npm-lifecycle \ node-gyp-bin \ .... \ node_modules \ node” -gyp \ bin \ node-gyp.js“rebuild”else(节点“C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ bin \ node-gyp.js”rebuild)gyp ERR!配置错误gyp ERR! stack错误:找不到Python可执行文件“python”,可以设置PYTHON env变量。 gyp ERR!堆栈在PythonFinder.failNoPython(C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ lib \ configure.js:483:19)gyp ERR!在PythonFinder堆栈。 (C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ lib \ configure.js:508:16)gyp ERR!堆栈在C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ graceful-fs \ polyfills.js:284:29 gyp ERR!堆栈在FSReqWrap.oncomplete(fs.js:152:21)gyp ERR!系统Windows_NT 6.1.7601 gyp ERR!命令“C:\ Program Files \ nodejs \ node.exe”“C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ bin \ node-gyp.js”“rebuild”gyp ERR! cwd D:\ gatsby-site \ node_modules \ sharp gyp ERR! node -v v8.11.1 gyp ERR! node-gyp -v v3.6.2 gyp ERR!不行npm WARN [email protected]需要graphql@^0.12.0 ||的对等体^ 0.13.0但没有安装。您必须自己安装对等依赖项。 npm WARN [email protected]需要一个graphql@^0.10.0 ||的对等体^ 0.11.0 || ^ 0.12.0 || ^ 0.13.0但没有安装。您必须自己安装对等依赖项。 npm WARN [email protected]需要graphql@^0.13.0的peer,但是没有安装。您必须自己安装对等依赖项。 npm WARN [email protected]需要使用typescript @ *的对等方,但是没有安装。您必须自己安装对等依赖项。 npm WARN可选SKIPPING OPTIONAL DEPENDENCY:[email protected](node_modules \ fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY:不支持的[email protected]平台:想要{“os”:“darwin”,“arch”:“any “}(当前:{”os“:”win32“,”arch“:”x64“})

错误的ERR!代码ELIFECYCLE npm ERR!错误1 npm ERR! [email protected]安装:(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) npm ERR!退出状态1 npm ERR!错误的ERR!在[email protected]安装脚本中失败。错误的ERR!这可能不是npm的问题。上面可能有额外的日志记录输出。

错误的ERR!可以在以下位置找到此运行的完整日志:npm ERR! C:\ Users \用户sharmatarun1 \应用程序数据\漫游\ NPM-cache_logs \ 2019-04-02T06_36_07_771Z-的debug.log

我已经从git网站搜索过这个错误,但问题出现了同样的问题。请帮我解决这个问题。

gatsby
2个回答
1
投票

您是否npm install项目的所有依赖项?如果你不使用gatsby-plugin-sharp,你可以从gatsby-config.js中删除它,看看你的应用程序是否在没有它的情况下运行。

你的Python环境似乎有些问题:Error: Can't find Python executable "python", you can set the PYTHON env variable.你在npm installing其他包时会出现这个错误吗?


0
投票

您是否安装了C ++工具:Visual Studio Community 2015或2017 Package和npm config set msvs_version 2015

npm install --global --production windows-build-tools

该工具似乎与python 3不兼容您可以在安装它之后强制使用Python 2 npm config set python python2.7或

node-gyp install --python C:\ Python27

© www.soinside.com 2019 - 2024. All rights reserved.