gpt4 book ai didi

reactjs - Gatsby 开发 : Something went wrong installing the "sharp" module

转载 作者:行者123 更新时间:2023-12-04 13:32:25 26 4
gpt4 key购买 nike

我刚刚在 Gatsby 上对入门模板进行了 git clone - 当我运行“gatsby develop”时遇到了这个错误。我已经删除了节点模块,以及节点模块中的sharp模块。无济于事。
请让我知道此时发生了什么! :-)

PS C:\Users\ipche\gatsby-strapi-starter> gatsby develop
success open and validate gatsby-configs - 0.073s

ERROR


Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp.node'
Require stack:
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp\lib\constructor.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp\lib\index.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\safe-sharp.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\extend-node-type.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\gatsby-node.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby\dist\bootstrap\resolve-module-exports.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby\dist\bootstrap\load-plugins\load.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby\dist\bootstrap\load-plugins\index.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby\dist\bootstrap\index.js
- C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby\dist\commands\develop-process.js
- C:\Users\ipche\gatsby-strapi-starter\.cache\tmp-19076-nq3SvOAJn7yo

- Remove the "node_modules/sharp" directory, run "npm install" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
- Search for this error at https://github.com/lovell/sharp/issues

在这里运行'npm build'

C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp\src\stats.cc(130,1): error C2661: 'v8::Object::Set': no overloa 
ded function takes 2 arguments [C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp\build\sharp.vcxproj]
C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp\src\stats.cc(140,20): warning C4834: discarding return value of
function with 'nodiscard' attribute [C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp\build\sharp.vcxproj]
C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp\src\pipeline.cc(1017,20): warning C4834: discarding return valu
e of function with 'nodiscard' attribute [C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp\build\sharp.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\ipche\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ipche\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"
"rebuild"
gyp ERR! cwd C:\Users\ipche\gatsby-strapi-starter\node_modules\gatsby-transformer-sharp\node_modules\sharp
gyp ERR! node -v v14.13.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.22.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.22.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! C:\Users\ipche\AppData\Roaming\npm-cache\_logs\2020-10-06T21_03_57_721Z-debug.log

顺便去package.json,把sharp的依赖版本改成'sharp@0.22.1'。以前是sharp@0.26.1!
任何线索?
编辑
运行'npm install --verboseSharp'

 1 Error(s)

Time Elapsed 00:00:11.67
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\ipche\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ipche\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"
"rebuild"
gyp ERR! cwd C:\Users\ipche\gatsby-strapi-starter\node_modules\sharp
gyp ERR! node -v v14.13.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm verb lifecycle sharp@0.22.1~install: unsafe-perm in lifecycle true
npm verb lifecycle sharp@0.22.1~install: PATH: C:\Users\ipche\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\ipche\gatsby-strapi-starter\node_modules\sharp\node_modules\.bin;C:\Users\ipche\gatsby-strapi-starter\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\PuTTY\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\ipche\anaconda3;C:\Users\ipche\anaconda3\Library\mingw-w64\bin;C:\Users\ipche\anaconda3\Library\usr\bin;C:\Users\ipche\anaconda3\Library\bin;C:\Users\ipche\anaconda3\Scripts;C:\Users\ipche\AppData\Local\Microsoft\WindowsApps;C:\Users\ipche\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\ipche\AppData\Local\GitHubDesktop\bin;C:\Panda3D-1.10.6-x64\python;C:\Panda3D-1.10.6-x64\python\Scripts;C:\Panda3D-1.10.6-x64\bin;C:\Users\ipche\Documents\GitHub\feelDetection\Panda3D-1.10.6-x64\python;C:\Users\ipche\Documents\GitHub\feelDetection\Panda3D-1.10.6-x64\python\Scripts;C:\Users\ipche\Documents\GitHub\feelDetection\Panda3D-1.10.6-x64\bin;C:\Users\ipche\AppData\Roaming\npm
npm verb lifecycle sharp@0.22.1~install: CWD: C:\Users\ipche\gatsby-strapi-starter\node_modules\sharp
npm info lifecycle sharp@0.22.1~install: Failed to exec install script
npm timing action:install Completed in 15700ms
npm verb unlock done using C:\Users\ipche\AppData\Roaming\npm-cache\_locks\staging-4a5f00369a03df36.lock for C:\Users\ipche\gatsby-strapi-starter\node_modules\.staging
npm timing stage:rollbackFailedOptional Completed in 250ms
npm timing stage:runTopLevelLifecycles Completed in 39766ms

最佳答案

首先删除 node_module 文件夹,然后尝试下面给出的方法!这对我有用
在package.json文件中手动更新sharp包的版本,然后尝试运行命令npm i sharp或者先安装sharp包,然后运行命令npm install

关于reactjs - Gatsby 开发 : Something went wrong installing the "sharp" module,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64233792/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com