Sharp: Can't install sharp on Win 7 Pro (x64)

Created on 20 Dec 2018  路  3Comments  路  Source: lovell/sharp

For some reason, whenever I try to install sharp on this computer I always get this error.

I tried running npm install --global --production windows-build-tools
I even installed entire Visual Studio Community Edition.
I installed Build Tools and Windows SDK.
I have Python 2.7, 3.5 & 3.6 on my computer.
I also have gyp.
I don't even remember how many things I tried in the past 5 hours and I still can't get it running.

On my Win 10 laptop it works fine but I need it running on this PC too.

Can anybody help me with this?

PS C:\Users\PC\Desktop\Node\sharp> npm i sharp --save

> [email protected] install C:\Users\PC\Desktop\Node\sharp\node_modules\sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-g
yp rebuild && node install/dll-copy)

info sharp Using cached C:\Users\PC\AppData\Roaming\npm-cache\_libvips\libvips-8
.7.0-win32-x64.tar.gz
ERR! sharp zlib: Cannot read property 'length' of null
ERR! sharp Please see http://sharp.pixelplumbing.com/page/install

C:\Users\PC\Desktop\Node\sharp\node_modules\sharp>if not defined npm_config_node
_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\nod
e_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
C:\Users\PC\Desktop\Node\sharp\node_modules\sharp\build\libvips-cpp.vcxproj(20,
3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microso
ft.Cpp\v4.0\v140\Microsoft.Cpp.Default.props" was not found. Confirm that the p
ath in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\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_proces
s.js:209:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\PC\Desktop\Node\sharp\node_modules\sharp
gyp ERR! node -v v9.2.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository 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 log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\PC\AppData\Roaming\npm-cache\_logs\2018-12-20T15_34_18_454
Z-debug.log
question

All 3 comments

Hello, please can you try deleting the cached C:\Users\PC\AppData\Roaming\npm-cache\_libvips\libvips-8.7.0-win32-x64.tar.gz file as it looks like it might have become corrupted.

I notice you're using Node 9, which reached end-of-life about 6 months ago. If you're able to use either Node 8 or 10 then you'll get the benefit of pre-compiled binaries.

Hello Lovell!
I just want to say THANK YOU!
Deleting the libvips- didn't help but I installed Node 10 and it finally works!
God... I was close to throwing my computer out of the window. :smile:

IIRC there was a bug in zlib handling in some versions of Node 9, likely the cause of the problem you were seeing.

Was this page helpful?
0 / 5 - 0 ratings