生成 Gatsby starter 时找不到 sharp 的预建库

Prebuilt libraries not found for sharp while generating Gatsby starter

我尝试使用以下命令生成 Gatsby blog starter

npx gatsby new my-blog-starter https://github.com/tomoyukikashiro/gatsby-starter-blog-amp-to-pwa

虽然 npm install 是 运行,但 sharp 第三方找不到其预构建的二进制文件。因此,将尝试在我的 PC 上构建它,但失败并出现以下错误。

info Installing packages...

> sharp@0.21.3 install C:\Repositories\my-blog-starter\node_modules\sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached C:\Users\Milan\AppData\Roaming\npm-cache\_libvips\libvips-8.7.0-win32-x64.tar.gz
info sharp Creating C:\Repositories\my-blog-starter\node_modules\sharp\build\Release
info sharp Copying DLLs from C:\Repositories\my-blog-starter\node_modules\sharp\vendor\lib to C:\Repositories\my-blog-st
arter\node_modules\sharp\build\Release
prebuild-install WARN install No prebuilt binaries found (target=12.17.0 runtime=node arch=x64 platform=win32)

C:\Repositories\my-blog-starter\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\nod
e_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (nod
e "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  VError.cpp
  VInterpolate.cpp
  VImage.cpp
  win_delay_load_hook.cc
     Creating library C:\Repositories\my-blog-starter\node_modules\sharp\build\Release\libvips-cpp.lib and object C:\Re
  positories\my-blog-starter\node_modules\sharp\build\Release\libvips-cpp.exp
  libvips-cpp.vcxproj -> C:\Repositories\my-blog-starter\node_modules\sharp\build\Release\libvips-cpp.dll
  common.cc
  metadata.cc
  stats.cc
  operations.cc
C:\Repositories\my-blog-starter\node_modules\nan\nan_implementation_12_inl.h(356,37): error C2660: 'v8::StringObject::N
ew': function does not take 1 arguments (compiling source file ..\src\metadata.cc) [C:\Repositories\my-blog-starter\nod
e_modules\sharp\build\sharp.vcxproj]

环境:

有什么提示,我该如何解决这个问题?对我来说,在本地构建第三方也可以,但我看不出到底缺少什么。

您的初学者需要 sharp 版本 0.21.3(如您的错误日志中所示)

windows 上的节点 12 支持在版本 0.22.1 中是 introduced

您可以尝试在启动器中升级 gatsby-plugin-sharpgatsby-transformer-sharp,但您可能会遇到其他错误,因为启动器有一段时间没有更新了。