Skip to content

Trouble with Node-Canvas make #1

@bensheldon

Description

@bensheldon

I'm having trouble installing node-canvas using this buildpack. Below is the section of npm install log when it starts trying to build canvas and then barfs.

       make: Entering directory `/tmp/build_3h09nz7zqlyu5/node_modules/canvas/build'
         CXX(target) Release/obj.target/canvas/src/Canvas.o
       In file included from ../src/Canvas.cc:8:
       ../src/Canvas.h:19:25: warning: cairo/cairo.h: No such file or directory
       ../src/Canvas.cc:15:29: warning: cairo/cairo-pdf.h: No such file or directory
       In file included from ../src/Canvas.cc:8:
       ../src/Canvas.h:63: error: 'cairo_status_t' has not been declared
       ../src/Canvas.h:79: error: ISO C++ forbids declaration of 'cairo_surface_t' with no type
       ../src/Canvas.h:79: error: 'cairo_surface_t' declared as an 'inline' field
       ../src/Canvas.h:79: error: expected ';' before '*' token
       ../src/Canvas.h:80: error: expected ';' before 'inline'
       ../src/Canvas.h:88: error: ISO C++ forbids declaration of 'cairo_surface_t' with no type
       ../src/Canvas.h:88: error: expected ';' before '*' token
       ../src/Canvas.h: In member function 'uint8_t* Canvas::data()':
       ../src/Canvas.h:81: error: '_surface' was not declared in this scope
       ../src/Canvas.h:81: error: 'cairo_image_surface_get_data' was not declared in this scope
       ../src/Canvas.h: In member function 'int Canvas::stride()':
       ../src/Canvas.h:82: error: '_surface' was not declared in this scope
       ../src/Canvas.h:82: error: 'cairo_image_surface_get_stride' was not declared in this scope
       In file included from ../src/CanvasRenderingContext2d.h:13,
                        from ../src/Canvas.cc:9:
       ../src/CanvasGradient.h: At global scope:
       ../src/CanvasGradient.h:21: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
       ../src/CanvasGradient.h:21: error: 'cairo_pattern_t' declared as an 'inline' field
       ../src/CanvasGradient.h:21: error: expected ';' before '*' token
       ../src/CanvasGradient.h:23: error: expected ';' before 'private'
       ../src/CanvasGradient.h:26: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
       ../src/CanvasGradient.h:26: error: expected ';' before '*' token
       In file included from ../src/Canvas.cc:9:
       ../src/CanvasRenderingContext2d.h:30: error: 'cairo_filter_t' does not name a type
       ../src/CanvasRenderingContext2d.h:31: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
       ../src/CanvasRenderingContext2d.h:31: error: expected ';' before '*' token
       ../src/CanvasRenderingContext2d.h:32: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
       ../src/CanvasRenderingContext2d.h:32: error: expected ';' before '*' token
       ../src/CanvasRenderingContext2d.h:33: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
       ../src/CanvasRenderingContext2d.h:33: error: expected ';' before '*' token
       ../src/CanvasRenderingContext2d.h:34: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
       ../src/CanvasRenderingContext2d.h:34: error: expected ';' before '*' token
       ../src/CanvasRenderingContext2d.h:130: error: 'cairo_t' has not been declared
       ../src/CanvasRenderingContext2d.h:131: error: ISO C++ forbids declaration of 'cairo_t' with no type
       ../src/CanvasRenderingContext2d.h:131: error: 'cairo_t' declared as an 'inline' field
       ../src/CanvasRenderingContext2d.h:131: error: expected ';' before '*' token
       ../src/CanvasRenderingContext2d.h:132: error: expected ';' before 'inline'
       ../src/CanvasRenderingContext2d.h:136: error: 'cairo_surface_t' has not been declared
       ../src/CanvasRenderingContext2d.h:137: error: expected ',' or '...' before '(' token
       ../src/CanvasRenderingContext2d.h:137: error: 'fn' has incomplete type
       ../src/CanvasRenderingContext2d.h:137: error: invalid use of 'void'
       ../src/CanvasRenderingContext2d.h:157: error: ISO C++ forbids declaration of 'cairo_t' with no type
       ../src/CanvasRenderingContext2d.h:157: error: expected ';' before '*' token
       ../src/CanvasRenderingContext2d.h:158: error: ISO C++ forbids declaration of 'cairo_path_t' with no type
       ../src/CanvasRenderingContext2d.h:158: error: expected ';' before '*' token
       ../src/CanvasRenderingContext2d.h: In member function 'void Context2d::setContext(int*)':
       ../src/CanvasRenderingContext2d.h:130: error: '_context' was not declared in this scope
       In file included from ../src/Canvas.cc:16:
       ../src/closure.h: At global scope:
       ../src/closure.h:22: error: 'cairo_status_t' does not name a type
       ../src/closure.h:29: error: 'cairo_status_t' does not name a type
       In file included from ../src/Canvas.cc:19:
       ../src/JPEGStream.h:100: error: variable or field 'write_to_jpeg_stream' declared void
       ../src/JPEGStream.h:100: error: 'cairo_surface_t' was not declared in this scope
       ../src/JPEGStream.h:100: error: 'surface' was not declared in this scope
       ../src/JPEGStream.h:100: error: expected primary-expression before 'int'
       ../src/JPEGStream.h:100: error: expected primary-expression before 'int'
       ../src/JPEGStream.h:100: error: expected primary-expression before '*' token
       ../src/JPEGStream.h:100: error: 'closure' was not declared in this scope
       make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
       make: Leaving directory `/tmp/build_3h09nz7zqlyu5/node_modules/canvas/build'
       gyp ERR! build error 
       gyp ERR! stack Error: `make` failed with exit code: 2
       gyp ERR! stack     at ChildProcess.onExit (/tmp/node-npm-lDkc/node_modules/node-gyp/lib/build.js:215:23)
       gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:91:17)
       gyp ERR! stack     at Process._handle.onexit (child_process.js:674:10)
       gyp ERR! System Linux 2.6.32-343-ec2
       gyp ERR! command "node" "/tmp/node-npm-lDkc/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
       gyp ERR! cwd /tmp/build_3h09nz7zqlyu5/node_modules/canvas
       gyp ERR! node -v v0.8.7
       gyp ERR! node-gyp -v v0.6.5
       gyp ERR! not ok 
       npm ERR! [email protected] install: `node-gyp rebuild`
       npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
       npm ERR! 
       npm ERR! Failed at the [email protected] install script.
       npm ERR! This is most likely a problem with the canvas package,
       npm ERR! not with npm itself.
       npm ERR! Tell the author that this fails on your system:
       npm ERR!     node-gyp rebuild
       npm ERR! You can get their info via:
       npm ERR!     npm owner ls canvas
       npm ERR! There is likely additional logging output above.

       npm ERR! System Linux 2.6.32-343-ec2
       npm ERR! command "/tmp/node-node-SXZt/bin/node" "/tmp/node-npm-lDkc/cli.js" "install" "--production"
       npm ERR! cwd /tmp/build_3h09nz7zqlyu5
       npm ERR! node -v v0.8.7
       npm ERR! npm -v 1.1.49
       npm ERR! code ELIFECYCLE
       npm ERR! 
       npm ERR! Additional logging details can be found in:
       npm ERR!     /tmp/build_3h09nz7zqlyu5/npm-debug.log
       npm ERR! not ok code 0
 !     Failed to install --production dependencies with npm

I'm not entirely sure what the problem is: if it's looking for the Cairo sourcefiles (and not finding them) or if it has something to do with the environment variables not being set. This is my environment on Heroku:

BUILDPACK_URL=git://github.com/bloomtime/heroku-buildpack-nodejs.git#cairo
TERM=xterm-256color
COLUMNS=204
PATH=bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin
PWD=/app
PS1=\[\033[01;34m\]\w\[\033[00m\] \[\033[01;32m\]$ \[\033[00m\]
LINES=24
HOME=/app
SHLVL=2
PORT=22974

And my package.json in case it's a version compatibility issue

Thanks for the help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions