gpt4 book ai didi

npm - 生成 Gatsby starter 时未找到用于Sharp的预构建库

转载 作者:行者123 更新时间:2023-12-04 09:45:43 25 4
gpt4 key购买 nike

我尝试生成一个 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]

环境:
  • Node.js 版本 12.17.0
  • npm 版本 6.14.4
  • npx 版本 10.2.2
  • 没有公司代理会阻止对预构建二进制文件的请求。

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

    最佳答案

    您的启动器需要 sharp版本0.21.3 (如您的错误日志中所示)

    Windows 上的节点 12 支持是 introduced在版本0.22.1 .

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

    关于npm - 生成 Gatsby starter 时未找到用于Sharp的预构建库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62127800/

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