sharp: fatal error: 'vips/vips8' file not found

I’m having problems installing sharp in a clean node:12 container.

docker run --rm -it node:12 npm i sharp

> sharp@0.23.0 install /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.8.1/libvips-8.8.1-linux-x64.tar.gz
prebuild-install WARN install libvips-cpp.so.42: cannot open shared object file: No such file or directory
make: Entering directory '/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:25:22: fatal error: vips/vips8: No such file or directory
 #include <vips/vips8>
                      ^
compilation terminated.
sharp.target.mk:135: recipe for target 'Release/obj.target/sharp/src/common.o' failed
make: *** [Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/node_modules/sharp/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:196:23)
gyp ERR! stack     at ChildProcess.emit (events.js:209:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 5.0.0-29-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /node_modules/sharp
gyp ERR! node -v v12.10.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data
npm WARN !invalid#1 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.23.0 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.23.0 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!     /root/.npm/_logs/2019-09-23T18_08_09_973Z-debug.log

The issue is quite unfamiliar to me and i havent find the cause yet. Im posting early hoping somebody can point me in the right direction.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 32
  • Comments: 41 (5 by maintainers)

Commits related to this issue

Most upvoted comments

It looks like commit https://github.com/isaacs/minipass/commit/40e1d612d3d58e415362b1ebb97df8b69da5374f might have collided with https://github.com/mafintosh/end-of-stream/issues/11 and/or commit https://github.com/isaacs/minipass/commit/69888ebfbced926a9da61f044fdd733810a874d2 might have collided with https://github.com/npm/node-tar/commit/42fe53b413527983f2509ae606412ee1e93761d7

This will affect most modules that (transitively) depend on minipass, tar and/or end-of-stream.

Pinning minipass to v2.7.0 should workaround this for now.

For those using yarn, you can add the following to your package.json:

  "resolutions": {
    "minipass": "2.7.0"
  },

Whatever is causing this problem, it looks like it’s affecting pretty much every native node module that provides prebuilt binaries

https://github.com/mapbox/node-pre-gyp/issues/477 https://github.com/mapbox/node-sqlite3/issues/1222

@imkane This issue is not closed, I am actively working on investigating it right now.

There was a breaking change in v2.8.2 of the upstream minipass dependency that has now been reverted in its v2.8.5 release.

If you work at a for-profit organisation that relies on sharp, and I can tell there are a lot of you based on the sheer volume of emails and notifications I’ve received about this problem over the last 15 hours, please consider donating to the libvips OpenCollective at https://opencollective.com/libvips to say thank you and help with its continued support.

I have same issue, without docker.

I have fixed our CI build by adding following to the package.json:

"dependencies": {
  "minipass": "2.7.0",
  "sharp": "^0.23.0"
}

It’s silly because our app does not depend on minipass.

There have been no changes to sharp or the prebuilt binaries since 29th July.

I’ve received about 30 emails and notifications about this problem within the last hour so would expect this to relate to a (transitive) dependency that has been published within the last couple of hours.

I’ve removed the resolution for minipass and can confirm it works. Thank you @lovell

Just ran:

apt-get update && apt-get install -y libvips-dev --no-install-recommends

and then

npm install sharp

Still got the same error.

I’m getting the same issue.

I’m using lerna with npm. For those who are using npm and not yarn.

Add minipass as a dependency or dev-dependency depending on where your issues lie.

"dependencies": {
  "minipass": "2.7.0",
}

For me this affects:

  • angular-cli/angular-compiler
  • grpc
  • sharp
  • lerna (@lerna/add)

So far I’ve tried installing libvips-dev (https://github.com/lovell/sharp/issues/1882#issuecomment-534241405) and glib2.0-dev (https://github.com/lovell/sharp/issues/1148#issuecomment-370688930).

FROM node:10
...
RUN apt-get update && apt-get install -y glib2.0-dev libvips-dev
...
RUN npm --build-from-source install

and the result is still:

> sharp@0.21.3 install /usr/src/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.7.0/libvips-8.7.0-linux-x64.tar.gz
make: Entering directory '/usr/src/app/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:25:0:
/usr/include/vips/vips8:35:25: fatal error: glib-object.h: No such file or directory
 #include <glib-object.h>
                         ^
compilation terminated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
sharp.target.mk:128: recipe for target 'Release/obj.target/sharp/src/common.o' failed
make: Leaving directory '/usr/src/app/node_modules/sharp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.19.43-microsoft-standard
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/sharp
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

for Ubuntu users: apt install libvips-dev fixes the issue for us.

This issue is fixed for me with minipass@^2.8.5, forced via resolutions in package.json (version pushed a few minutes ago)

I have fixed our CI build by adding following to the package.json:

"dependencies": {
  "minipass": "2.7.0",
  "sharp": "^0.23.0"
}

It’s silly because our app does not depend on minipass.

This workaround fixed the issue for us as well. Using node:11.6.0 Docker image.

I have the same problem, it was because my network I couldn’t download libvips-8.8.1-win32-x64.tar.gz success, So I have to manual download it and put it on %appdata%/npm-cache/_libvips.

Yes it worked on Docker with Node 12.10.0 image with libvips-dev.

This one did help so far:

...
RUN apt-get update && apt-get install -y libvips-dev --no-install-recommends
...

Also seeing this attempting to install sharp@0.22.1 in a Google Cloud Function running Node 8:

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.4/libvips-8.7.4-linux-x64.tar.gz
prebuild-install
WARN install libvips-cpp.so.42: cannot open shared object file: No such file or directory
../src/common.cc:25:10: fatal error: vips/vips8: No such file or directory
 #include <vips/vips8>
^~~~~~~~~~~~
compilation terminated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.15.0-1044-gcp
gyp ERR! command \"/usr/bin/node\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
gyp ERR! cwd /workspace/node_modules/sharp
gyp ERR! node -v v8.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.22.1 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.22.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

We’ve been running on this specific version of Sharp / Node / GCF for awhile now without any issues, it just began today.

image

I’m getting this issue too when trying to push to heroku.