JohnMcLear / draw

A real time collaborative drawing tool using nodejs, socket.io & paper.js
Apache License 2.0
482 stars 158 forks source link

Cannot find module 'canvas' #253

Closed zaigham-mt closed 7 years ago

zaigham-mt commented 7 years ago

Error: Cannot find module 'canvas' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17)

I even tried using npm install canvas still facing issue. Using OSX

bytesnz commented 7 years ago

Did canvas install correctly? You should be able to something like the below from the draw directory if it did

$ node
> var canvas = require('canvas');
undefined
> canvas
{ [Function: Canvas]
  version: '1.6.5',
  cairoVersion: '1.14.6',
  jpegVersion: '6b',
  gifVersion: '5.1.4',
  freetypeVersion: '2.7.1',
  Context2d: { [Function: CanvasRenderingContext2D] parseFont: [Function] },
  PNGStream: [Function: PNGStream],
  PDFStream: [Function: PDFStream],
  JPEGStream: [Function: JPEGStream],
  Image: { [Function: Image] MODE_IMAGE: 1, MODE_MIME: 2 },
  ImageData: [Function: ImageData],
  Font: [Function: Font] }
> 
zaigham-mt commented 7 years ago

var canvas = require('canvas'); Error: Cannot find module 'canvas' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at repl:1:14 at REPLServer.defaultEval (repl.js:252:27) at bound (domain.js:287:14) at REPLServer.runBound [as eval] (domain.js:300:12) at REPLServer. (repl.js:417:12) at emitOne (events.js:82:20)

Plus I am unable to install canvas as facing following issues.

npm install canvas \

canvas@1.3.15 install /Users/zaighammaqsood/Downloads/draw-master/node_modules/canvas node-gyp rebuild

./util/has_lib.sh: line 30: pkg-config: command not found gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onex

On 24-Mar-2017, at 3:53 AM, Jack Farley notifications@github.com wrote:

Did canvas install correctly? You should be able to something like the below from the draw directory if it did

$ node

var canvas = require('canvas'); undefined canvas { [Function: Canvas] version: '1.6.5', cairoVersion: '1.14.6', jpegVersion: '6b', gifVersion: '5.1.4', freetypeVersion: '2.7.1', Context2d: { [Function: CanvasRenderingContext2D] parseFont: [Function] }, PNGStream: [Function: PNGStream], PDFStream: [Function: PDFStream], JPEGStream: [Function: JPEGStream], Image: { [Function: Image] MODE_IMAGE: 1, MODE_MIME: 2 }, ImageData: [Function: ImageData], Font: [Function: Font] }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JohnMcLear/draw/issues/253#issuecomment-288884892, or mute the thread https://github.com/notifications/unsubscribe-auth/AOivT5Rt2mSIWQHD3UWobDnYE4nVv52dks5rovf4gaJpZM4MmjWV.

bytesnz commented 7 years ago

See https://www.npmjs.com/package/canvas You need to install the canvas dependencies first: brew install pkg-config cairo libpng jpeg giflib

zaigham-mt commented 7 years ago

Is it supported for Windows too ?

On 24-Mar-2017, at 12:59 PM, Jack Farley notifications@github.com wrote:

See https://www.npmjs.com/package/canvas https://www.npmjs.com/package/canvas You need to install the canvas dependencies first: brew install pkg-config cairo libpng jpeg giflib

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JohnMcLear/draw/issues/253#issuecomment-288956873, or mute the thread https://github.com/notifications/unsubscribe-auth/AOivT2FwMV67hU7FwUWRZNf7EWKix-v4ks5ro3figaJpZM4MmjWV.

zaigham-mt commented 7 years ago

Is there any option for rubber or to remove lines in this code.

On 24-Mar-2017, at 12:59 PM, Jack Farley notifications@github.com wrote:

See https://www.npmjs.com/package/canvas https://www.npmjs.com/package/canvas You need to install the canvas dependencies first: brew install pkg-config cairo libpng jpeg giflib

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JohnMcLear/draw/issues/253#issuecomment-288956873, or mute the thread https://github.com/notifications/unsubscribe-auth/AOivT2FwMV67hU7FwUWRZNf7EWKix-v4ks5ro3figaJpZM4MmjWV.

bytesnz commented 7 years ago

With the cursor tool you can select a line and then delete it with the delete button.

zaigham-mt commented 7 years ago

It's working, thanks :)

Sent from my iPhone

On 24-Mar-2017, at 12:59 PM, Jack Farley notifications@github.com wrote:

See https://www.npmjs.com/package/canvas You need to install the canvas dependencies first: brew install pkg-config cairo libpng jpeg giflib

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

bytesnz commented 7 years ago

np