2016-07-23 81 views
0

即时通讯尝试使用快递生成器制作包含节点和快递的应用程序,并用node-webkit封装所有内容。 express生成器创建一个非常基本的应用程序,但它运行npm start localhost:30000。如何使节点Webkit与快递生成器一起工作

清单

{ 
    "name": "app", 
    "version": "0.0.0", 
    "private": true, 
    "node-main": "./app.js", 
    "main": "http://localhost:8080", 
    "scripts": { 
    "start": "node ./bin/www" 
    }, 
    "dependencies": { 
    "body-parser": "~1.15.1", 
    "bower": "^1.7.9", 
    "cookie-parser": "~1.4.3", 
    "debug": "~2.2.0", 
    "express": "~4.13.4", 
    "morgan": "~1.7.0", 
    "pug": "^2.0.0-beta4", 
    "serve-favicon": "~2.3.0" 
    } 
} 

的文件夹结构 Folder strcture

当我运行nwjs应用程序的窗口显示该页面无法加载,但控制台不显示任何错误。我试图改变

“主”:“http://localhost:8080”为“主”:“http://localhost:3000

这是怎么应用程序通常运行,但它没有工作,要么。

enter image description here

这可能吗? 我在想什么?

在此先感谢

回答

0

这可能有点晚,但无论如何。 这里是来源:https://github.com/nwjs/nw.js/wiki/NW.js-use-express-and-similar-web-frameworks

node-main应该有文件路径,它建立了服务器。在这种情况下,我假设它位于bin目录中并命名为www。因此,package.json应该是这样的:

{ 
... 
"node-main": "./bin/www", 
"main": "http://localhost:3000", 
... 
} 

还检查端口号,如果它是3000或其他东西。

相关问题