【问题标题】:Can't install Gatsby starter theme because of Sharp module failing由于 Sharp 模块失败,无法安装 Gatsby 入门主题
【发布时间】:2021-07-01 10:48:39
【问题描述】:

我已经安装了 MSBuild 工具,下载了当前的 Node.js 版本,删除了 libvips 文件,但 Gatsby 仍然无法从 Starters 安装简单的主题。

我使用的是 Windows 10。

[4/4] Building fresh packages...
[-/5] ⠁ waiting...
[2/5] ⠁ sharp
[-/5] ⠁ waiting...
[-/5] ⠁ waiting...
error C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp: Command failed.
Exit code: 7
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp
Output:
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-win32-x64.tar.gz
info sharp Creating C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp\build\Release     
info sharp Copying DLLs from C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp\vendor\lib to C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp\build\Release
prebuild-install WARN install No prebuilt binaries found (target=15.13.0 runtime=node arch=x64 platform=win32)

C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp>if not defined npm_config_node_gyp (node "D:\nodejs15130\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\momom\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@8.0.0
gyp info using node@15.13.0 | win32 | x64
gyp info find Python using Python version 3.9.2 found at "C:\Python39\python.exe"
gyp info find VS using VS2017 (15.9.28307.1440) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python39\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\momom\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\momom\\Desktop\\dsd\\metdig\\node_modules\\sharp\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\momom\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\momom\\AppData\\Local\\node-gyp\\Cache\\15.13.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\momom\\AppData\\Local\\node-gyp\\Cache\\15.13.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\momom\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\momom\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\15.13.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\momom\\Desktop\\dsd\\metdig\\node_modules\\sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\momom\\Desktop\\dsd\\metdig\\node_modules\\sharp\\build',gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files\visualStudio\MSBuild\Current\Bin\MSbuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files\visualStudio\MSBuild\Current\Bin\MSbuild.exe ENOENT
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
gyp ERR! stack     at onErrorNT (node:internal/child_process:480:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:81:21)  
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "D:\\nodejs15130\\node.exe" "C:\\Users\\momom\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp
gyp ERR! node -v v15.13.0
gyp ERR! node-gyp -v v8.0.0





momom@Serein2020 MINGW64 ~/Desktop/dsd/metdig
$ npm i gatsby-plugin-sharp
npm notice 
npm notice New minor version of npm available! 7.7.6 -> 7.8.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.8.0
npm notice Run npm install -g npm@7.8.0 to update!
npm notice
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'got@5.7.1',
npm WARN EBADENGINE   required: { node: '>=0.10.0 <7' },
npm WARN EBADENGINE   current: { node: 'v15.13.0', npm: '7.7.6' }
npm WARN EBADENGINE }

changed 78 packages, and audited 1934 packages in 19s

78 packages are looking for funding
  run `npm fund` for details

59 vulnerabilities (30 low, 6 moderate, 21 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

momom@Serein2020 MINGW64 ~/Desktop/dsd/metdig
$ yarn
yarn install v1.22.4
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other 
than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
warning gatsby > babel-preset-es2015@6.24.1: �  Thanks for using Babel: we recommend using 
 babel-preset-env now: please read https://babeljs.io/env to update!
warning gatsby > chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 
with 15x less dependencies.
warning gatsby > core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning gatsby > babel-polyfill > core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning gatsby > babel-runtime > core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning gatsby > gatsby-plugin-page-creator > chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning gatsby > gatsby-cli > core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning gatsby > joi@12.0.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning gatsby > postcss-cssnext@2.11.0: 'postcss-cssnext' has been deprecated in favor of 
'postcss-preset-env'. Read more at https://moox.io/blog/deprecating-cssnext/
warning gatsby > socket.io > debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have 
a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
warning gatsby > webpack-validator > joi@9.0.0-0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version 
to get the best features, bug fixes, and security patches. If you are unable to upgrade at 
this time, paid support is available for older versions (hapi.im/commercial).
warning gatsby > babel-core > babel-register > core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning gatsby > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning gatsby > gatsby-1-config-extract-plugin > extract-text-webpack-plugin@1.0.1: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
warning gatsby > joi > topo@2.0.2: This version has been deprecated in accordance with the 
hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning gatsby > webpack-validator > joi > topo@2.0.2: This version has been deprecated in 
accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning gatsby > joi > hoek@4.2.1: This version has been deprecated in accordance with the 
hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning gatsby > webpack-validator > joi > hoek@4.2.1: This version has been deprecated in 
accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning gatsby > joi > topo > hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning gatsby > postcss-cssnext > autoprefixer > browserslist@1.7.7: Browserslist 2 could 
fail on reading Browserslist >3.0 config used in other tools.
warning gatsby > postcss-cssnext > caniuse-api > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning gatsby > postcss-cssnext > pixrem > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning gatsby > postcss-import > pkg-resolve@0.1.14: Not maintained anymore.
warning gatsby > react > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the 
actual version of core-js@3.
warning gatsby > remote-redux-devtools > redux-devtools-core@0.2.1: Package moved to @redux-devtools/app.
warning gatsby > remote-redux-devtools > redux-devtools-instrument@1.10.0: Package moved to @redux-devtools/instrument.
warning gatsby > socket.io > engine.io > debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 
<4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)    
warning gatsby > socket.io > socket.io-parser > debug@4.1.1: Debug versions >=3.2.0 <3.2.7 
|| >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
warning gatsby > webpack > watchpack > chokidar@1.7.0: Chokidar 2 will break on node v14+. 
Upgrade to chokidar 3 with 15x less dependencies.
warning gatsby > webpack-validator > joi > items@2.1.2: This module has been deprecated in 
accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version of hapi to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). 
warning gatsby > css-loader > cssnano > postcss-merge-rules > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning gatsby > postcss-import > pkg-resolve > jspm > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning gatsby > remote-redux-devtools > redux-devtools-core > remotedev-serialize@0.1.9: Package moved to @redux-devtools/serialize.
warning gatsby > postcss-import > pkg-resolve > jspm > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning gatsby > postcss-import > pkg-resolve > jspm > jspm-npm > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning gatsby > postcss-import > pkg-resolve > jspm > jspm-github > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning gatsby > postcss-import > pkg-resolve > jspm > request > har-validator@5.1.5: this 
library is no longer supported
warning gatsby > chokidar > readdirp > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning gatsby > chokidar > readdirp > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning gatsby-plugin-offline > sw-precache@5.2.1: Please migrate to Workbox: https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
warning gatsby-plugin-offline > sw-precache > sw-toolbox@3.6.0: Please migrate to Workbox: 
https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
warning gatsby-plugin-sharp > probe-image-size > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning gatsby-plugin-sharp > imagemin-pngquant > pngquant-bin > bin-wrapper > download > gulp-decompress > gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
warning gatsby-remark-copy-linked-files > cheerio > cheerio-select-tmp@0.1.1: Use cheerio-select instead
warning gatsby-source-filesystem > chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning gatsby-source-filesystem > babel-cli > chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding 
it from installation.
[3/4] Linking dependencies...
warning "gatsby > friendly-errors-webpack-plugin@1.7.0" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning "gatsby > postcss-cssnext@2.11.0" has unmet peer dependency "caniuse-db@^1.0.30000652".
warning "gatsby-plugin-react-helmet > react-helmet@5.2.1" has unmet peer dependency "react@>=15.0.0".
warning "gatsby-plugin-react-helmet > react-helmet > react-side-effect@1.2.0" has unmet peer dependency "react@^0.13.0 || ^0.14.0 || ^15.0.0 || ^16.0.0".
warning "gatsby-transformer-remark > graphql-type-json@0.1.4" has unmet peer dependency "graphql@>=0.4.0".
[4/4] Building fresh packages...
[-/5] ⠈ waiting...
[2/5] ⠈ sharp
[-/5] ⠁ waiting...
[-/5] ⠁ waiting...
error C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp: Command failed.
Exit code: 7
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp
Output:
info sharp Using cached C:\Users\momom\AppData\Roaming\npm-cache\_libvips\libvips-8.6.1-win32-x64.tar.gz
info sharp Creating C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp\build\Release     
info sharp Copying DLLs from C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp\vendor\lib to C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp\build\Release
prebuild-install WARN install No prebuilt binaries found (target=15.13.0 runtime=node arch=x64 platform=win32)

C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp>if not defined npm_config_node_gyp (node "D:\nodejs15130\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\momom\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@8.0.0
gyp info using node@15.13.0 | win32 | x64
gyp info find Python using Python version 3.9.2 found at "C:\Python39\python.exe"
gyp info find VS using VS2017 (15.9.28307.1440) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python39\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\momom\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\momom\\Desktop\\dsd\\metdig\\node_modules\\sharp\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\momom\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\momom\\AppData\\Local\\node-gyp\\Cache\\15.13.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\momom\\AppData\\Local\\node-gyp\\Cache\\15.13.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\momom\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\momom\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\15.13.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\momom\\Desktop\\dsd\\metdig\\node_modules\\sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\momom\\Desktop\\dsd\\metdig\\node_modules\\sharp\\build',gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files\visualStudio\MSBuild\Current\Bin\MSbuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files\visualStudio\MSBuild\Current\Bin\MSbuild.exe ENOENT
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
gyp ERR! stack     at onErrorNT (node:internal/child_process:480:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:81:21)  
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "D:\\nodejs15130\\node.exe" "C:\\Users\\momom\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\momom\Desktop\dsd\metdig\node_modules\sharp
gyp ERR! node -v v15.13.0
gyp ERR! node-gyp -v v8.0.0

【问题讨论】:

    标签: node.js gatsby


    【解决方案1】:

    对我来说,它失败是由于一些 Visual Studio 问题,而不是尖锐的,因为以下命令:

    gyp ERR! stack Error: spawn C:\Program Files\visualStudio\MSBuild\Current\Bin\MSbuild.exe ENOENT
    

    您的机器似乎没有采用正确版本的 windows-build-tools 或 msvs,它必须是 2015 年,作为 docs shows:

    npm install --global windows-build-tools --vs2015
    

    根据一些similar issues,问题可以通过以下方式解决:

    npm config set msvs_version 2015
    

    其他需要将 Python 版本设置为 2.7 的用户:

    npm config set python python2.7
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-07
      • 2011-11-21
      • 2018-12-03
      • 2018-10-07
      相关资源
      最近更新 更多