Gatsby Develop : 安装“sharp"程序时出现问题模块 [英] Gatsby Develop : Something went wrong installing the "sharp" module

查看:242
本文介绍了Gatsby Develop : 安装“sharp"程序时出现问题模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I just did a git clone off a starter template on Gatsby-- bumped into this error when I ran 'gatsby develop'. I've deleted the node module, as well as the sharp module in node module. To no avail. Do let me know what's going on at this point! :-)

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'

Ran 'npm build' here

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!

By the way, I went to package.json and changed the dependency version of sharp to 'sharp@0.22.1'. It was previously sharp@0.26.1!

有线索吗?

编辑运行'npm install --verboseSharp'

EDIT Ran ' npm install --verbose sharp'

 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 文件夹,然后尝试下面给出的方法!这对我有用

Delete the node_module folder first and then try out the below-given methods! This works for me

在package.json文件中手动更新sharp包的版本,然后尝试运行命令npm iSharp

Update the version of the sharp package manually in the package.json file and then try to run the command npm i sharp

或者先安装sharp包,然后运行命令npm install

or first, install sharp package and then run the command npm install

这篇关于Gatsby Develop : 安装“sharp"程序时出现问题模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆