【问题标题】:Uncaught Error when nat-upnp in Node-Webkit在 Node-Webkit 中进行 nat-upnp 时未捕获的错误
【发布时间】:2023-03-27 16:42:01
【问题描述】:

我在 node-webkit 中通过 nat-upnp 模块尝试 upnp。我可以在 Node.js 控制台中使用 nat-upnp。但是在 node-webkit 中,发生了未捕获的错误。

编码,

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)
});

错误,

[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:

环境这个,

OS X 10.9.1
Node v0.8.26
node-webkit v0.8.4

【问题讨论】:

    标签: javascript node.js express upnp node-webkit


    【解决方案1】:

    您是否使用本机模块?原生模块应使用 nw-gyp 编译以与 node-webkit 一起使用:

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

    【讨论】:

      猜你喜欢
      • 2014-10-25
      • 2014-11-18
      • 2012-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多