Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: 'vips/vips8' file not found #1882

Closed
midgethoen opened this issue Sep 23, 2019 · 41 comments · Fixed by CruGlobal/campus-contacts-web#384
Closed

fatal error: 'vips/vips8' file not found #1882

midgethoen opened this issue Sep 23, 2019 · 41 comments · Fixed by CruGlobal/campus-contacts-web#384

Comments

@midgethoen
Copy link

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.

@8shaks
Copy link

8shaks commented Sep 23, 2019

image

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

@rrohan92
Copy link

I'm getting the same issue.

@jbdutton
Copy link

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.

@ChrisCates
Copy link

Guys, please review the documentation and use a libvips compatible container: https://github.com/TailorBrands/docker-libvips

@sidiliu
Copy link

sidiliu commented Sep 23, 2019

Get the same issue without installing it on docker

@Workito
Copy link

Workito commented Sep 23, 2019

I have same issue, without docker.

@hfukada
Copy link

hfukada commented Sep 23, 2019

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

@lovell
Copy link
Owner

lovell commented Sep 23, 2019

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.

@lovell lovell changed the title unable to install sharp to latest node:12 docker container fatal error: 'vips/vips8' file not found Sep 23, 2019
@lovell
Copy link
Owner

lovell commented Sep 23, 2019

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

mapbox/node-pre-gyp#477
TryGhost/node-sqlite3#1222

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

@imkane
Copy link

imkane commented Sep 23, 2019

Sorry, my mistake! I misread the referenced issue statuses. Good luck!

@emplums
Copy link

emplums commented Sep 23, 2019

Is there any way to work around this for now?

@adamlacombe
Copy link

So far I've tried installing libvips-dev (#1882 (comment)) and glib2.0-dev (#1148 (comment)).

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

@gate8team
Copy link

gate8team commented Sep 23, 2019

This one did help so far:

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

@rrohan92
Copy link

Just ran:

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

and then

npm install sharp

Still got the same error.

@imkane
Copy link

imkane commented Sep 23, 2019

This one did help so far:

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

Not for us :(

@timothyallan
Copy link

Strange. libvips-dev on Docker with Node 12.10.0 image fixed it up for me.

@lovell
Copy link
Owner

lovell commented Sep 23, 2019

My current line of inquiry is that this relates to a recent change in one of the dependencies used to unpack tar files. For example, the minipass dependency, which is a dependency of tar was published an hour ago.

@christianbundy
Copy link

Out of desparation I tried Yarn and I'm surprised to report that it works for me.

I installed on Debian Buster from these instructions and when I ran yarn it installed all of my modules without any problems. For what it's worth, I can confirm these things don't work (for me):

  • changing Node version (node 10 and 12 both broken)
  • using npm install --sharp-cxx11=1
  • installing libvips, libvips-dev, or removing both
  • turning it off and back on again

Of course, using Yarn is just a temporary workaround, but it might help if you're in a pinch.

@lovell Thanks so much for your work on this module!

@rrohan92
Copy link

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

@lovell
Copy link
Owner

lovell commented Sep 23, 2019

It looks like commit isaacs/minipass@40e1d61 might have collided with mafintosh/end-of-stream#11 and/or commit isaacs/minipass@69888eb might have collided with isaacs/node-tar@42fe53b

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"
  },

@evallgar
Copy link

Follow up on this issue here:
isaacs/minipass#9

@Shane325
Copy link

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 also worked for me.

@tihuan
Copy link

tihuan commented Sep 23, 2019

#1882 (comment) <-- this worked for me! Thanks so much, @lovell 🙏

@liudonghua123
Copy link

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.

@DavidDudson
Copy link

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)

amcclain added a commit to xh/hoist-dev-utils that referenced this issue Sep 24, 2019
+ This reverts commit 1b7bafd
+ Transitive dep minipass is currently sick and failing the build - see lovell/sharp#1882
@Dave-Lindberg
Copy link

Adding minipass 2.8.3 allowed me to successfully add libvips 0.0.2, but npm i sharp@latest still not installing.

The sharp installation docs says:

libvips and its dependencies are fetched and stored within node_modules/sharp/vendor during npm install.

My current sharp installation has no vendor directory:

  • binding.gyp
  • docs
  • install
  • lib
  • LICENSE
  • node_modules
  • package.json
  • README
  • src

@harrisrobin
Copy link

Adding

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

as @lovell suggested worked for me!

@liudonghua123
Copy link

Adding

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

as @lovell suggested worked for me!

This works, but the same error when I install expo-cli, and I could not apply this patch.

@auctifera-josed
Copy link

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 also fixed the installation problem for us

iTonyYo added a commit to gelue-club/gelue.club that referenced this issue Sep 24, 2019
…t found`

`minipass` 依赖项导致了该问题,目前通过 `resolutions` 字段、Yarn 包管理器来解决该问题。问题细节参见:

- lovell/sharp#1882
- isaacs/minipass#9
@xlanor
Copy link

xlanor commented Sep 24, 2019

Encountering this issue with turtle-cli. Will attempt the suggested solution and report back

@edcolyer
Copy link

edcolyer commented Sep 24, 2019

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.

@xlanor
Copy link

xlanor commented Sep 24, 2019

expo-cli does not work even with minipass added into dependencies.

@RefersToTheLostYouth
Copy link

添加minipass可以正常编译了

@dlecan
Copy link

dlecan commented Sep 24, 2019

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

@midgethoen
Copy link
Author

midgethoen commented Sep 24, 2019

it works again for me too, even without adding minipass. thnx for investigating

$ 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
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
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.

+ sharp@0.23.0
added 71 packages from 102 contributors and audited 164 packages in 6.931s
found 0 vulnerabilities

@lovell
Copy link
Owner

lovell commented Sep 24, 2019

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.

@harryhazza77
Copy link

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

OzzieOrca added a commit to CruGlobal/campus-contacts-web that referenced this issue Sep 24, 2019
- Bump travis node version to 12
- Bump minipass to 2.8.5 to fix lovell/sharp#1882 (comment)
@JandenMa
Copy link

I used yarn and npm i on my Gatsby project, and got the same issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.