Reputation: 404
I'm trying to install sharp
in my nodejs project in windows using,
npm install sharp
But getting the following error:
> [email protected] 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 [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] 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 [email protected] 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
I've tried using nodejs version 11.x, 12.6.0, 13.x, 14.15.0
I think this line is what causing the issue
ERR! sharp Prebuilt libvips 8.10.0 binaries are not yet available for win32-x64
I tried many solutions found in GitHub issues and StackOverflow but none of them worked.
Upvotes: 2
Views: 3240
Reputation: 63
Try changing the sharp
and sharp_libvips
binary host
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
Upvotes: 1