【问题标题】:How to create node.js project to standalone exe file for windows.如何将 node.js 项目创建为 Windows 的独立 exe 文件。
【发布时间】:2015-12-29 20:57:51
【问题描述】:

我在 Node js 中构建了一个应用程序,它使用 Websockets 将事件传递给浏览器。我想将该应用程序捆绑到一个 .exe 文件中,以便它可以在客户端计算机上运行而无需安装 Node。

我搜索了几种方法,最后使用 Nexe 进行捆绑。 一切正常,但是当我运行输出文件时,Websocket 模块出现问题。

TypeError: WebSocketServer is not a function
at Array.__dirname.call.C:\Users\Raghav Tandon\WinPos\BrowserIntegrat
ion\js\RestImpl.js.http (nexe.js:15287:12)
at initModule (nexe.js:29:11)
at nexe.js:31:64
at Array.__dirname.call.C:\Users\Raghav Tandon\WinPos\BrowserIntegrat
ion\js\RestWS.js../RestImpl (nexe.js:48:20)
at initModule (nexe.js:29:11)
at Array.forEach (native)
at nexe.js:39:8
at nexe.js:46:4
at NativeModule.compile (node.js:945:5)
at Function.NativeModule.require (node.js:893:18)

电子可以工作吗?

请帮助我了解如何将 Node 应用程序捆绑到 .exe 文件。

请分享执行此操作的最佳做​​法。 TIA

【问题讨论】:

    标签: node.js windows websocket exe electron


    【解决方案1】:

    根据nexe docs:

    不支持原生模块

    nexe 尚不支持本机模块。因此,您的案例将不起作用,因为它使用了 natvie 模块。

    或者,如果您不在乎支付费用,enclosejs 会为您提供帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-06
      • 2021-10-31
      • 2010-10-16
      • 2017-01-08
      相关资源
      最近更新 更多