[英]successfully compiled custom node.js module how do I use it
I was having a lot of problems using npm to install the canvas module for node.js, so I downloaded the source code, and used visual studio 2005 to debug and correct the errors I was running into. 使用npm为node.js安装画布模块时遇到了很多问题,因此我下载了源代码,并使用Visual Studio 2005调试和纠正了我遇到的错误。 I got it to successfully compile, but now I don't know know where to go from there in order to be able to use it in my project.
我可以成功编译它,但是现在我不知道从那里可以在我的项目中使用它。 Seems like it should be easy, but I don't even know where to begin.
似乎应该很容易,但是我什至不知道从哪里开始。
Rename the compiled .dll file to .node and drop it in your node project. 将已编译的.dll文件重命名为.node并将其放入您的节点项目中。 Then just
require
it. 然后只
require
它。
For example, in a folder: 例如,在文件夹中:
app.js
canvas.node
...
In app.js: 在app.js中:
var canvas = require('./canvas');
Note that in the case of the canvas module, you should have no problems using npm to install it if you have a proper node native build environment ( node-gyp ) set up, which includes Python 2.7 and MS Visual C++ 2010 (and for x64 builds, the Win 7 x64 SDK ). 请注意,在canvas模块的情况下, 如果您设置了正确的节点本机构建环境( node-gyp ),其中包括Python 2.7和MS Visual C ++ 2010 (并且适用于x64), 则使用npm安装它应该没有问题。构建Win 7 x64 SDK )。 VS 2005 won't work.
VS 2005无法正常工作。
You'll obviously also need cario installed since canvas depends on it. 您显然还需要安装cario,因为canvas依赖于此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.