简体   繁体   中英

How to install "gatsby-plugin-sharp" plugin

When I run the command gatsby develop to start development server, I get the following error message:

success open and validate gatsby-configs — 0.006 s error UNHANDLED REJECTION

Error: Unable to find plugin "gatsby-plugin-sharp". Perhaps you need to install its package?

  • 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

  • new Promise

  • 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

And when I try to install it, it shows following message:

 npm install --save gatsby-plugin-sharp

sharp@0.21.3 install D:\\gatsby-site\\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.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>if not defined npm_config_node_gyp (node "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\npm-lifecycle\\node-gyp-bin\\....\\node_modules\\node-gyp\\bin\\node-gyp.js" rebuild ) else (node "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" rebuild ) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:483:19) gyp ERR! stack at PythonFinder. (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:508:16) gyp ERR! stack at C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\graceful-fs\\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "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! not ok npm WARN eslint-plugin-graphql@2.1.1 requires a peer of graphql@^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN express-graphql@0.6.12 requires a peer of graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN graphql-tools@3.1.1 requires a peer of graphql@^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN ts-pnp@1.0.1 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself. 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":"win32","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) (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!
C:\\Users\\sharmatarun1\\AppData\\Roaming\\npm-cache_logs\\2019-04-02T06_36_07_771Z-debug.log

I have already searched for this error from git site but the issue came out the same. Please help me resolve this issue.

Did you npm install all the dependencies for your project? If you don't use gatsby-plugin-sharp , you could remove it from the gatsby-config.js and see if your app is running without it.

Something seems to be wrong with your Python environment: Error: Can't find Python executable "python", you can set the PYTHON env variable. Do you get this error when npm install ing other packages?

Did you install C++ tools : Visual Studio Community 2015 or 2017 Package and npm config set msvs_version 2015

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

The tool does not seem compatible with python 3 You can force the use of Python 2 after installing it npm config set python python2.7 or

node-gyp install --python C:\\Python27

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM