node.js - 在 Windows 64bit 中安装Sharp时出错
问题描述
我正在尝试sharp
在 windows 中安装我的 nodejs 项目,
npm install sharp
但得到以下错误:
> sharp@0.26.2 install C:\Projects\React Native\done-with-it-api\node_modules\sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.0/libvips-8.7.0-win32-x64.tar.gzlibvips-8.10.0-win32-x64.tar.br
ERR! sharp Prebuilt libvips 8.10.0 binaries are not yet available for win32-x64
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
C:\Projects\React Native\done-with-it-api\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Users\user\AppData\Roaming\nvm\v12.13.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\user\AppData\Roaming\nvm\v12.13.1\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.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not find WindowsS
DKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [C:\Projects
\React Native\done-with-it-api\node_modules\sharp\build\libvips-cpp.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Projects\React Native\done-wit
h-it-api\node_modules\sharp\build\libvips-cpp.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not find WindowsS
DKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [C:\Projects
\React Native\done-with-it-api\node_modules\sharp\node-addon-api\nothing.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Projects\React Native\done-wit
h-it-api\node_modules\sharp\node-addon-api\nothing.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\user\AppData\Roaming\nvm\v12.13.1\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\nvm\\v12.13.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Projects\React Native\done-with-it-api\node_modules\sharp
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN done-with-it-backend@1.0.0 No description
npm WARN done-with-it-backend@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.26.2 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.26.2 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\user\AppData\Roaming\npm-cache\_logs\2020-11-14T06_47_15_482Z-debug.log
我试过使用nodejs version 11.x, 12.6.0, 13.x, 14.15.0
我认为这条线是导致问题的原因
ERR! sharp Prebuilt libvips 8.10.0 binaries are not yet available for win32-x64
我尝试了许多在 GitHub 问题和 StackOverflow 中找到的解决方案,但都没有奏效。
解决方案
推荐阅读
- kubernetes - 如何获取一堆短期 Kubernetes 作业的指标
- css - 如何解决 Google Search Console 中“可点击元素靠得太近”的问题
- git - 如何对他人的回购大师提出拉取请求?(已创建新分支)
- ios - SwiftUI:如何调整大小以适应 Button 以展开以填充 VStack 或 HStack 父视图?
- c++ - C++ RapidJson 帮助反序列化数组对象
- sql - sql中基于传输的时差逻辑
- r - 计算按列数分组的平均值
- wordpress - 如何从我的 WordPress 站点获取所有端点 URL?我需要获取登录页面、注销页面、忘记密码页面等
- xml - 节点的 XSLT 计算
- html - 在 CSS 中为页面上的每个元素添加叠加颜色