简体   繁体   English

成功编译自定义node.js模块我该如何使用

[英]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.7MS 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.

相关问题 使用Node.Js模块,如何在同一模块中使用对象功能? - Using Node.Js Modules, how do I use an object function in the same module? 如何使用Node.js的“异步”模块在一个函数中执行“ A”或“ B”,然后始终执行“ C”? - How can I use the Node.js 'async' module to do 'A' or 'B' and then always 'C' in one function? 如何在带有 Node.js 的 JavaScript 模块文件之间使用事件处理程序? - How do I use event handlers between JavaScript module files with Node.js? 如何使用node.js模块Passport-google - How do I use the node.js module passport-google 如何使用 node.js 请求模块使用我自己的证书进行 SSL 调用? - How do I use the node.js request module to make an SSL call with my own certificate? 我如何在Node.js中使用tropo模块? - How can i use tropo module with node.js? 如何使用node.js请求模块发送文件? - How do I send a file with node.js request module? 如何使用 node.js 中的 azure/identity 模块进行身份验证? - How do I authenticate with azure/identity module in node.js? 如何在Node.js的RequireJS中适当地为模块命名 - How do I properly alias a module in RequireJS on Node.js 我如何知道在Ubuntu 14.04上是否已成功安装Node.js和npm? - How do I know whether I have Node.js and npm successfully installed on Ubuntu 14.04?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM