2013-01-06 56 views
0

试图使用节点尖锐 - https://github.com/anodejs/node-sharp加载一些现有的.NET组件我有。目前为止还没有能够实现它 - 只是似乎得到了“找不到指定的程序”。Node.js的扩展.NET

所以我试图启动一个简单的例子,并按照本指南 - http://coderesearchlabs.com/articles/BNWCA.pdf。同样的结果。

我在Windows 64上运行使用的是Node.js的32位版本的安装版本0.8.16。

错误堆栈跟踪 -

> require("./Sharp").hello 
Error: The specified procedure could not be found. 
C:\Program Files (x86)\nodejs\Sharp.node 
    at Object.Module._extensions..node (module.js:485:11) 
    at Module.load (module.js:356:32) 
    at Function.Module._load (module.js:312:12) 
    at Module.require (module.js:362:17) 
    at require (module.js:378:17) 
    at repl:1:2 
    at REPLServer.self.eval (repl.js:109:21) 
    at Interface.<anonymous> (repl.js:248:12) 
    at Interface.EventEmitter.emit (events.js:96:17) 
    at Interface._onLine (readline.js:200:10) 
> console.log('Version: ' + process.version); 
Version: v0.8.16 
undefined 
> 

来源是

#pragma comment(lib, "node") 

#include <node.h> 
#include <v8.h> 

using namespace node; 
using namespace v8; 

extern "C" void NODE_EXTERN init (Handle<Object> target) 

{ 

HandleScope scope; 

target->Set(String::New("hello"), String::New("world")); 

} 

NODE_MODULE(test, init) 
+0

检查我的答案在这里:http://stackoverflow.com/a/11389044/709537我运行在x64 node.js的,但它应该工作一样好用于x86。 –

+0

的Tx的链接 - 这帮助了很多 – glose

回答

1

确保模块名称匹配什么传递给NODE_MODULE

NODE_MODULE(test, init) // => `test.node` 
NODE_MODULE(Sharp, init) // => `Sharp.node` 

此外,作为指导似乎之后的节点0.6.x与0.8.0 released,您可能会发现Addonsnode-gyp有助于节点0.8开发的文档。

+0

TX - 这让我在正确的轨道上。主要问题是v0.8的变化与样本的写入。 – glose