2
votes

I am installing canvas on ubuntu 16.04 LTS for installing npm package qr-js.

I performed these steps - 1. sudo apt-get update 2. sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++ 3. sudo npm install canvas

and the result is-

npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.

my nodejs version is v4.2.6 & npm is v3.5.2

can any body help me..?

2

2 Answers

0
votes

I think the canvas installation faces issues wit the new kernel present in v16.04 of Ubuntu. Try using v14.04. Hope this helped.

I.M.

0
votes

I could relatively solve the problem, I had the same problem, well thats my case I was attempted to install canvas locally and it wasn't possible I don't know why, however was possible install globally so the idea was change the path where I call the "canvas" I was attempted run some example I could find here. https://github.com/Automattic/node-canvas . The only change I did was change <> by var Canvas = require('canvas') and the way how construct an object var canvas = Canvas.createCanvas(200, 200) by I hope it can find someone! .