Skip to content

Install Problem: 'jpeglib.h' file not found #348

Closed

Description

@georgecoltart

I've been going round the bend trying to solve this.
When I attempt to install I get:

npm install canvas
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan

> canvas@1.1.1 install /Users/georgecoltart/Sites/tilestitch/node_modules/canvas
> node-gyp rebuild

  CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.cc:19:
../src/JPEGStream.h:11:10: fatal error: 'jpeglib.h' file not found
#include <jpeglib.h>
         ^
1 error generated.
make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
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:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/georgecoltart/Sites/tilestitch/node_modules/canvas
gyp ERR! node -v v0.10.21
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

Having done a search, the jpeglib.h file is in /usr/include/jpeglib.h
I'm pretty sure I installed it correctly, but it must be a broken reference.

Can someone tell me where this jpeg lib is expected to be located for the canvas install to find it?

Thanks a lot.

Activity

  1. sethfitz commented on Oct 26, 2013

    @sethfitz
    Contributor

    jpeglib.h is in /usr/local/include on my system, having been installed via brew install jpeg. How did you install it?

  2. georgecoltart commented on Oct 26, 2013

    @georgecoltart
    Author

    Yes it was installed via brew, and it does exist at that location: /usr/local/include
    Should the npm install be looking there?
    Im on 10.9 which might not be helping things...

  3. sethfitz commented on Oct 26, 2013

    @sethfitz
    Contributor

    I just upgraded from 10.7 to 10.9, so I'm trying to reproduce.

    npm install cairo didn't work out of the box (where it previously did), even with PKG_CONFIG set. So far, I've done the following:

    brew uninstall cairo
    brew install cairo
    # fails, tells me to link pixman
    brew link pixman
    brew install cairo
    # fails, tells me to install XQuartz
    # install XQuartz
    brew install cairo
    # fails, tells me to install Xcode Command Line Tools
    xcode-select --install
    brew install cairo
    # installs glib, cairo
    PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/X11/lib/pkgconfig npm install canvas
    # installs node-canvas successfully

    I didn't do anything with jpeg here, but you might have better luck brew uninstall jpeg && brew install jpeg first...

  4. georgecoltart commented on Oct 26, 2013

    @georgecoltart
    Author

    Fixed!
    I seemed to have missed any warning about Xcode Command Tools, and was certain that Cairo had successfully installed where maybe it hadnt. I'd reinstalled it a number of times without any warnings.

    O well thanks a lot!

  5. justnolanzh commented on Nov 11, 2013

    @justnolanzh

    I also encountered this problem, no solution

  6. georgecoltart commented on Nov 11, 2013

    @georgecoltart
    Author

    If you are on Mavericks, you'll need to install the Xcode command line tools, even if you did it on mountain lion.
    See top answer here: http://stackoverflow.com/questions/9329243/xcode-4-4-and-later-install-command-line-tools

    The errors I was getting didnt mention anything about this, however it was this that fixed the issue, so I would double check you have this installed correctly.

  7. justnolanzh commented on Nov 11, 2013

    @justnolanzh

    I'm on Mavericks. Thanks a lot , I have solved.

    brew update
    brew doctor
    xcode-select --install
    brew install cairo gobject-introspection pixman
  8. ajatolah commented on Mar 5, 2014

    @ajatolah

    I had the same problem, yhostc's solution solved it, thank you

  9. davidrinnan commented on Apr 29, 2014

    @davidrinnan

    I had the same problem. Found this post. Wrote 'xcode-select --install'
    in terminal and installed xcode command line tools via the prompt
    retried npm install canvas and it worked directly without issues and without reinstalling cairo via homebrew. so many thanks @georgecoltart

  10. soyuka commented on Aug 29, 2014

    @soyuka

    Thanks @yhostc! xcode-select --install did the trick. I think this comes from my recent migration to Mavericks.

    My steps were:

    brew install cairo
    brew link cairo
    #see brew issue below
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/X11/lib/pkgconfig
    xcode-select --install
    npm i canvas
    

    see #14123 for the pkgconfig

    This should definitely be added to the wiki.

  11. nodecode commented on Sep 29, 2014

    @nodecode

    I had the same problem, and I have long searched on the internet, but nothing has solved the problem. But now with brew uninstall jpeg && brew install jpeg it finally worked. jpeg was indeed installed before, but apparently there was a mistake. Thanks @mojodna

    $ brew uninstall jpeg && brew install jpeg
    Uninstalling /usr/local/Cellar/jpeg/8d...
    ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/jpeg-8d.mavericks.bottle.2.tar.gz
    ######################################################################## 100,0%
    ==> Pouring jpeg-8d.mavericks.bottle.2.tar.gz
    🍺  /usr/local/Cellar/jpeg/8d: 18 files, 780K
  12. piranna commented on Sep 30, 2014

    @piranna
    Contributor

    I'm having the same problem, but in this case in Ubuntu 14.10, not on OSX... :-(

  13. PaulMougel commented on Oct 1, 2014

    @PaulMougel

    Here's how I fixed it:

    1. Install X11
    2. Run
    $ xcode-select --install
    $ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig
    $ npm install
  14. dosapati commented on Mar 27, 2015

    @dosapati

    Had the same issue, yhostc's solution solved it, thank you

  15. yaserabdelaziz commented on Jul 9, 2015

    @yaserabdelaziz

    No one of these solutions helped in my case, but this helped fix it :
    https://gist.github.com/darul75/9125097

  16. piranna commented on Aug 9, 2015

    @piranna
    Contributor

    I think node-canvas should download the dependencies and compile them statically to prevent this problems...

  17. Drjacky commented on Oct 18, 2015

    @Drjacky

    What about in ubuntu?!

  18. piranna commented on Oct 18, 2015

    @piranna
    Contributor

    My fork download all dependencies and compike them statically inside the canvas.node binary, so these problems are not happening anymore. I did a pull-request sometime ago.

  19. dbkaplun commented on Oct 23, 2015

    @dbkaplun

    +1

  20. lizhanhui commented on Dec 15, 2015

    @lizhanhui

    For Ubuntu users, please install the package: libjpeg-dev
    It works for Wily(15.04 64bit).

  21. 0326 commented on Jan 21, 2016

    @0326

    $ xcode-select --install works for mac!

  22. tomerb15 commented on Jan 24, 2016

    @tomerb15

    I did a lot of the things writen here for my mac OSX but non seam to work.

    Finally i uninstalled node-canvas from my node_modules library and reinstall it and now i can work with jpegs!

    I feel like i have won a gold medal at the Olympics

  23. whxaxes commented on Feb 1, 2016

    @whxaxes

    great !!!!!!!!! xcode-select --install works

    thanks a lot

  24. LinusU commented on Feb 15, 2016

    @LinusU
    Collaborator

    Please try xcode-select --install :)

  25. piranna commented on Feb 15, 2016

    @piranna
    Contributor

    As I said before, by compiling statically this problem gets fixed. My pull-request is waiting...

  26. zhaotai commented on May 10, 2016

    @zhaotai

    My solution is the same with @LinusU.
    Just xcode-select --install.

  27. javadba commented on Apr 23, 2017

    @javadba

    xcode-select --install works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions