Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"The specified module could not be found" when building a canvas with node-gyp

I would like to install the https://github.com/LearnBoost/node-canvas/ module. I followed the windows installation instruction here

https://github.com/LearnBoost/node-canvas/wiki/Installation---Windows .

After typing: npm install canvas I got the following log:

Creating library F:\Stittch2\node_modules\canvas\build\Release\canvas.lib
and object F:\Stittch2\node_modules\canvas\build\Release\canvas.exp
Generating code
Finished generating code
canvas.vcxproj -> F:\Stittch2\node_modules\canvas\build\Release\\canvas.node
[email protected] node_modules\canvas
└── [email protected]

So I thought its compiled successfully, but when I do require('canvas') in node I'm getting the following error:

>node
>require('canvas')
Error: The specified module could not be found.
F:\Stittch2\node_modules\canvas\build\Release\canvas.node
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (F:\Stittch2\node_modules\canvas\lib\bindings.js:2:18)

with 32bit Node/npm.

Seems that I'm not getting this error only with this module.

like image 801
Deepsy Avatar asked Feb 20 '14 14:02

Deepsy


People also ask

What is node-gyp in NPM?

node-gyp is a cross-platform command-line tool written in Node. js for compiling native addon modules for Node. js. It contains a vendored copy of the gyp-next project that was previously used by the Chromium team, extended to support the development of Node. js native addons.

Do I need to install node-gyp?

node-gyp dependencies If you only need to compile add-ons during the project setup, Node. js should cover it for you. However, if you are an add-on developer, you probably need to install node-gyp globally. To use node-gyp, first, we'll need to install a Python runtime, the make utility, and a C or C++ compiler.

Can you use canvas in node?

createCanvas() Creates a Canvas instance. This method works in both Node. js and Web browsers, where there is no Canvas constructor.


1 Answers

does this fix solves your issue?

https://github.com/nodejs/node/pull/4215

I think this has been fixed and Node.js 5.3.0 was released with it.

https://github.com/nodejs/node/pull/4281

Hope this helps!

like image 87
Sathish Avatar answered Sep 20 '22 12:09

Sathish