首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在windows 64位中安装sharp时出错

在windows 64位中安装sharp时出错
EN

Stack Overflow用户
提问于 2020-11-14 07:04:44
回答 1查看 2K关注 0票数 1

我试图在windows中的nodejs项目中安装sharp

代码语言:javascript
复制
npm install sharp

但是得到以下错误:

代码语言:javascript
复制
> 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

我认为这句话是导致这个问题的原因

代码语言:javascript
复制
ERR! sharp Prebuilt libvips 8.10.0 binaries are not yet available for win32-x64

我尝试了许多在GitHub问题和StackOverflow中找到的解决方案,但都没有奏效。

EN

回答 1

Stack Overflow用户

发布于 2022-04-08 08:56:26

尝试更改sharpsharp_libvips二进制主机

代码语言:javascript
复制
npm config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
npm config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
npm install sharp
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64831670

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档