Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uncaught: Error: Cannot find module '../build/default/canvas' #29

Closed
retrofox opened this issue Oct 20, 2010 · 5 comments
Closed

uncaught: Error: Cannot find module '../build/default/canvas' #29

retrofox opened this issue Oct 20, 2010 · 5 comments
Labels

Comments

@retrofox
Copy link

uncaught: Error: Cannot find module '../build/default/canvas'

@tj
Copy link
Contributor

tj commented Oct 20, 2010

first you need to run:

$ node-waf configure build

then after it is configured, each time you want to build it you just need to:

$ node-waf build

@panosru
Copy link

panosru commented May 20, 2012

@visionmedia I have the same issue... check this:

root@dev:/usr/local/lib/node_modules/protos# npm install canvas
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas

> [email protected] preinstall /usr/local/lib/node_modules/protos/node_modules/canvas
> node-waf configure build

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
Checking for library gif                 : not found 
Checking for library jpeg                : yes 
Checking for cairo                       : yes 
'configure' finished successfully (0.325s)
Waf: Entering directory `/usr/local/lib/node_modules/protos/node_modules/canvas/build'
[ 1/10] cxx: src/Canvas.cc -> build/Release/src/Canvas_1.o
../src/Canvas.cc: In constructor ‘Canvas::Canvas(int, int, canvas_type_t)’:
../src/Canvas.cc:392:20: warning: unused variable ‘status’ [-Wunused-variable]
[ 2/10] cxx: src/CanvasGradient.cc -> build/Release/src/CanvasGradient_1.o
[ 3/10] cxx: src/CanvasPattern.cc -> build/Release/src/CanvasPattern_1.o
[ 4/10] cxx: src/CanvasRenderingContext2d.cc -> build/Release/src/CanvasRenderingContext2d_1.o
../src/CanvasRenderingContext2d.cc: In constructor ‘Context2d::Context2d(Canvas*)’:
../src/CanvasRenderingContext2d.cc:132:25: warning: converting to non-pointer type ‘short int’ from NULL [-Wconversion-null]
../src/CanvasRenderingContext2d.cc: In static member function ‘static v8::Handle<v8::Value> Context2d::GetTextDrawingMode(v8::Local<v8::String>, const v8::AccessorInfo&)’:
../src/CanvasRenderingContext2d.cc:951:45: warning: ‘mode’ may be used uninitialized in this function [-Wuninitialized]
[ 5/10] cxx: src/Image.cc -> build/Release/src/Image_1.o
[ 6/10] cxx: src/ImageData.cc -> build/Release/src/ImageData_1.o
[ 7/10] cxx: src/PixelArray.cc -> build/Release/src/PixelArray_1.o
[ 8/10] cxx: src/color.cc -> build/Release/src/color_1.o
[ 9/10] cxx: src/init.cc -> build/Release/src/init_1.o
[10/10] cxx_link: build/Release/src/Canvas_1.o build/Release/src/CanvasGradient_1.o build/Release/src/CanvasPattern_1.o build/Release/src/CanvasRenderingContext2d_1.o build/Release/src/Image_1.o build/Release/src/ImageData_1.o build/Release/src/PixelArray_1.o build/Release/src/color_1.o build/Release/src/init_1.o -> build/Release/canvas.node
Waf: Leaving directory `/usr/local/lib/node_modules/protos/node_modules/canvas/build'
'build' finished successfully (5.324s)
[email protected] ./node_modules/canvas
root@dev:/usr/local/lib/node_modules/protos# cd node_modules/canvas/
root@dev:/usr/local/lib/node_modules/protos/node_modules/canvas# node-waf configure build
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
Checking for library gif                 : not found 
Checking for library jpeg                : yes 
Checking for cairo                       : yes 
'configure' finished successfully (0.330s)
Waf: Entering directory `/usr/local/lib/node_modules/protos/node_modules/canvas/build'
Waf: Leaving directory `/usr/local/lib/node_modules/protos/node_modules/canvas/build'
'build' finished successfully (0.028s)
root@dev:/usr/local/lib/node_modules/protos/node_modules/canvas# node-waf build
Waf: Entering directory `/usr/local/lib/node_modules/protos/node_modules/canvas/build'
Waf: Leaving directory `/usr/local/lib/node_modules/protos/node_modules/canvas/build'
'build' finished successfully (0.017s)
root@dev:/usr/local/lib/node_modules/protos/node_modules/canvas# 

but still when I try to compile .styl with nib I get this:

Error: Cannot find module '../build/default/canvas'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/protos/node_modules/canvas/lib/bindings.js:7:20)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)

I removed the try {} catch() {} for canvas in nib.js for debugging purposes.

//try {
  Canvas = require('canvas');

  var gradient = require('./nodes/gradient')
    , colorImage = require('./nodes/color-image')
    //} catch (err) {
  // ignore
  //}

@Skqing
Copy link

Skqing commented Jun 28, 2012

How i will use it in Windows?

@curran
Copy link

curran commented Nov 7, 2012

How was the error resolved? I just ran npm install canvas and am getting the same error Cannot find module '../build/default/canvas' Thank you!

@TooTallNate
Copy link
Contributor

@curran Make sure you're installing the latest version of canvas, and not a pinned version because of a package.json file.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants