Reputation: 5098
I've been trying to install the npm package canvas all day. I ran:
sudo npm install canvas
but i get:
[email protected] install /home/mark/Programming/canvas_npm/node_modules/canvas
node-gyp rebuild
make: Entering directory /home/mark/Programming/canvas_npm/node_modules/canvas/build' SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node COPY Release/canvas-postbuild.node CXX(target) Release/obj.target/canvas/src/Canvas.o In file included from ../src/Canvas.cc:7:0: ../src/Canvas.h:22:17: fatal error: nan.h: No such file or directory #include <nan.h> ^ compilation terminated. make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1 make: Leaving directory/home/mark/Programming/canvas_npm/node_modules/canvas/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:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.13.0-37-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/mark/Programming/canvas_npm/node_modules/canvas
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Linux 3.13.0-37-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
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! Please include the following file with any support request:
npm ERR! /home/mark/Programming/canvas_npm/npm-debug.log
The specific problem causing the error appears to be:
fatal error: nan.h: No such file or directory
I have installed Cairo using homebrew. I ideas why i cannot install canvas?
Upvotes: 0
Views: 2208
Reputation: 5098
Looks like its an issue with canvas version 1.2.24. I solved by installing 1.2.23
Upvotes: 0
Reputation: 3947
My solution (for Ubuntu) was to install the nan package:
npm install nan
Then copy the nan headers to /usr/include/
sudo cp node_modules/nan/nan*.h /usr/include/
Upvotes: 1