Search code examples
npmgatsbysharp

Prebuilt libraries not found for sharp while generating Gatsby starter


I try to generate a Gatsby blog starter using following command:

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

While npm install is running the sharp thirdparty does not find its prebuilt binaries. Because of this it will be tried to be built on my PC, but it fails with following error.

info Installing packages...

> [email protected] 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]

Environment:

  • Node.js version 12.17.0
  • npm version 6.14.4
  • npx version 10.2.2
  • There is no corporate proxy that would block the requests for the prebuilt binaries.

Are there any tips, how can I solve this issue? For me it is also fine to build the thirdparty locally, but I don't see exactly what is missing.


Solution

  • Your starter requires sharp version 0.21.3 (as shown in your error log)

    Node 12 support on windows was introduced in version 0.22.1.

    You could try upgrading gatsby-plugin-sharp and gatsby-transformer-sharp in your starter, but you might encounter other errors, as the starter hasn't been updated for a while.