Sharp: Windows: Cannot open include file: 'vips/intl.h' in latest version

Created on 22 Sep 2018  路  6Comments  路  Source: lovell/sharp

Windows: Cannot open include file: 'vips/intl.h' in latest version

Description

I am trying to install sharp on a windows 10 machine, and am seeing an error annot open include file: 'vips/intl.h' in latest version see full error message below.

Resolution Attempt

_What I have tried_
I have tried everything that I can find online to resolve the issue. I have installed windows-build-tools, set my python path, npm config set python python2.7, npm config set msvs_version 2015, npm config set msvs_version 2017. Nothing seems to work so I started working back through the versions and found that [email protected] installs without issues.

My Environment

node: v9.3.0
os: Windows 10 Pro 1709

Install

_command I ran to install sharp_

npm i sharp

Error

_Error that came back after attempting to install_

> [email protected] install C:\temp\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\user\AppData\Roaming\npm-cache\_libvips\libvips-8.6.1-win32-x64.tar.gz
>(node:15952) UnhandledPromiseRejectionWarning: ZlibError: zlib: unexpected end of file
    at Zlib.(anonymous function).onerror (C:\temp\node_modules\minizlib\index.js:131:21)
    at Unzip.write (C:\temp\node_modules\minizlib\index.js:255:31)
    at Unzip.flush (C:\temp\node_modules\minizlib\index.js:222:10)
    at Unzip.end (C:\temp\node_modules\minizlib\index.js:229:10)
    at Unpack.end (C:\temp\node_modules\tar\lib\parse.js:415:21)
    at Yallist.pipes.forEach.p (C:\temp\node_modules\minipass\index.js:288:18)
    at Yallist.forEach (C:\temp\node_modules\yallist\yallist.js:154:8)
    at ReadStream.emit (C:\temp\node_modules\minipass\index.js:285:18)
    at ReadStream.emit (C:\temp\node_modules\fs-minipass\index.js:153:22)
    at ReadStream.[maybeEmitEnd] (C:\temp\node_modules\minipass\index.js:255:12)
(node:15952) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15952) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
info sharp Creating C:\temp\node_modules\sharp\build\Release
info sharp Copying DLLs from C:\temp\node_modules\sharp\vendor\lib to C:\temp\node_modules\sharp\build\Release
ERR! sharp ENOENT: no such file or directory, scandir 'C:\temp\node_modules\sharp\vendor\lib'
prebuild-install WARN install No prebuilt binaries found (target=9.3.0 runtime=node arch=x64 platform=win32)

C:\temp\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Users\user\AppData\Roaming\npm\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\npm\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
..\src\libvips\cplusplus\VError.cpp(33): fatal error C1083: Cannot open include file: 'vips/intl.h': No  such file or directory [C:\temp\node_modules\sharp\build\libvips-cpp.vcxproj]
..\src\libvips\cplusplus\VInterpolate.cpp(34): fatal error C1083: Cannot open include file: 'vips/intl. h': No such file or directory [C:\temp\node_modules\sharp\build\libvips-cpp.vcxproj]
..\src\libvips\cplusplus\VImage.cpp(41): fatal error C1083: Cannot open include file: 'vips/intl.h': No  such file or directory [C:\temp\node_modules\sharp\build\libvips-cpp.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\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:159:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\temp\node_modules\sharp
gyp ERR! node -v v9.3.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\temp\package.json'
npm WARN temp No description
npm WARN temp No repository field.
npm WARN temp No README data
npm WARN temp No license field.

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\2018-09-22T14_14_01_945Z-debug.log
question

Most helpful comment

Hello, does removing the cached (and from the zlib: unexpected end of file error somehow corrupted) C:\Users\user\AppData\Roaming\npm-cache\_libvips\libvips-8.6.1-win32-x64.tar.gz file help?

All 6 comments

Hello, does removing the cached (and from the zlib: unexpected end of file error somehow corrupted) C:\Users\user\AppData\Roaming\npm-cache\_libvips\libvips-8.6.1-win32-x64.tar.gz file help?

@lovell Worked flawlessly! I did previously try npm cache clean -f, but that did not take care of this. Manually deleting the C:\Users\user\AppData\Roaming\npm-cache\_libvips directory solved the issue. Thanks for your help.

had the same issue while installing gatsby. Nothing worked except for the solution mentioned by @WaylonWalker

@lovell @WaylonWalker Thanks, I have faced the same problem, after I removed %APPDATA%\npm-cache\_libvips then it worked, and I found the %APPDATA%\npm-cache\_libvips\libvips-8.6.1-win32-x64.tar.gz was 0KB, that's really strange.

Finally, I found the key cause, it was my network problem, I have to manual download this file and put it on the right location in order to act as a cache.

Turns out it was also a network problem for me. Downloading the file manually (https://github.com/lovell/sharp-libvips/releases/download/v8.7.4/libvips-8.7.4-win32-x64.tar.gz in my case) and placing it in the \npm-cache\_libvips folder fixed the problem for me. 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iq-dot picture iq-dot  路  3Comments

jaekunchoi picture jaekunchoi  路  3Comments

Andresmag picture Andresmag  路  3Comments

kachurovskiy picture kachurovskiy  路  3Comments

zilions picture zilions  路  3Comments