0

I trying upnp in node-webkit by nat-upnp module.I can use nat-upnp in Node.js console.But in node-webkit,Uncaught Error occurred.

code this,

var express = require("express")
 , app = express()
 , fs = require('fs')
 , natUpnp = require('nat-upnp')
 , client = natUpnp.createClient()
;

//This function is to Map port
function startMap(){
 client.portMapping({
   public: 12345,
   private: 8080,
   ttl: 10
 }, function(err) {
   console.log(err)
   //if err,try again.
   startMap()
 });
}

startMap()

//Video server
app.get('/', function(req, res){
 stream = fs.createReadStream('output.mp4')
 res.setHeader('Content-Type', 'video/mp4');
 stream.pipe(res)
});

error this,

[49589:0213/054956:INFO:CONSOLE(79)] "Uncaught Error:
 dlopen(/Users/endotakashi/bin/chips/node_modules/nat-upnp/node_modules/netroute/build/Release/netroute.node, 1):
no suitable image found. Did find:

Environment this,

OS X 10.9.1
Node v0.8.26
node-webkit v0.8.4
endotakashi
  • 163
  • 1
  • 2
  • 6

1 Answers1

0

Are you using native modules? Native modules should be compiled with nw-gyp to work with node-webkit:

https://github.com/rogerwang/node-webkit/wiki/Build-native-modules-with-nw-gyp

Roger Wang
  • 1,388
  • 10
  • 8