Sharp: ERR! sharp zlib.BrotliDecompress is not a constructor.

Created on 26 Aug 2020  路  2Comments  路  Source: lovell/sharp

Command on Windows 10 PowerShell:

npm i -D sharp

> [email protected] install C:\my-app\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\Me\AppData\Roaming\npm-cache\_libvips\libvips-8.10.0-win32-x64.tar.br
ERR! sharp zlib.BrotliDecompress is not a constructor
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:\my-app\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm枚glichen, m眉ssen Sie den Schalter "/m" hinzuf眉gen.
  VError.cpp
  VConnection.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 di
rectory [C:\my-app\node_modules\sharp\build\libvips-cpp.vcxproj]
..\src\libvips\cplusplus\VConnection.cpp(34): fatal error C1083: Cannot open include file: 'vips/intl.h': No such file
or directory [C:\my-app\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:\my-app\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 di
rectory [C:\my-app\node_modules\sharp\build\libvips-cpp.vcxproj]
  nothing.c
  win_delay_load_hook.cc
  nothing.vcxproj -> C:\my-app\node_modules\sharp\build\Release\\nothing.lib
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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\my-app\node_modules\sharp
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\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 WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchpack-chokidar2\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 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\Me\AppData\Roaming\npm-cache\_logs\2020-08-26T16_35_50_544Z-debug.log
PS C:\my-app> npm i -D sharp

> [email protected] install C:\my-app\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.10.0/libvips-8.10.0-win32-x64.tar.br
C:\my-app\node_modules\sharp\install\libvips.js:46
    new zlib.BrotliDecompress(),
    ^

TypeError: zlib.BrotliDecompress is not a constructor
    at extractTarball (C:\my-app\node_modules\sharp\install\libvips.js:46:5)
    at WriteStream.<anonymous> (C:\my-app\node_modules\sharp\install\libvips.js:118:11)
    at WriteStream.emit (events.js:189:13)
    at lazyFs.close (internal/fs/streams.js:207:14)
    at FSReqWrap.args [as oncomplete] (fs.js:140:20)

C:\my-app\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm枚glichen, m眉ssen Sie den Schalter "/m" hinzuf眉gen.
  VError.cpp
  VConnection.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 di
rectory [C:\my-app\node_modules\sharp\build\libvips-cpp.vcxproj]
..\src\libvips\cplusplus\VConnection.cpp(34): fatal error C1083: Cannot open include file: 'vips/intl.h': No such file
or directory [C:\my-app\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 di
rectory [C:\my-app\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:\my-app\node_modules\sharp\build\libvips-cpp.vcxproj]
  nothing.c
  win_delay_load_hook.cc
  nothing.vcxproj -> C:\my-app\node_modules\sharp\build\Release\\nothing.lib
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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\my-app\node_modules\sharp
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\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 WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchpack-chokidar2\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 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\Me\AppData\Roaming\npm-cache\_logs\2020-08-26T16_44_51_267Z-debug.log

I already cleared the npm-cache and the node_modules.
The version 0.23 works. (Versions between not tested.)
I use Node version 10.15.3 (can't update to 12.x because of other dependencies. So not tested with v12. But I guess it. Breaking Changes?)

question

Most helpful comment

sharp v0.26.0 requires Node.js 10.16.0+

https://sharp.pixelplumbing.com/changelog#v0260---25th-august-2020

All 2 comments

sharp v0.26.0 requires Node.js 10.16.0+

https://sharp.pixelplumbing.com/changelog#v0260---25th-august-2020

Thanks. I updated to the latest Node version 10.x (10.22) and installed sharp 0.26 again. It works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

henbenla picture henbenla  路  3Comments

janaz picture janaz  路  3Comments

jaekunchoi picture jaekunchoi  路  3Comments

jaydenseric picture jaydenseric  路  3Comments

zilions picture zilions  路  3Comments