error in electron js when implementing express js

时间:2015-07-29 00:42:21

标签: node.js express electron

I'm trying to build a desktop application using electron js .I want to integrate express js in my application .when I try to start my application,I'm facing this error

onRendered

here is my code:

[Main Instruction]
A JavaScript error occured in the browser process

[Content]
Uncaught Exception:
Error: listen EADDRINUSE :::3000
    at Object.exports._errnoException (util.js:814:11)
    at exports._exceptionWithHostPort (util.js:837:20)
    at Server._listen2 (net.js:1214:14)
    at listen (net.js:1250:10)
    at Server.listen (net.js:1340:5)
    at EventEmitter.listen (C:\Users\Kobbi\WebstormProjects\untitled14\node_modules\express\lib\application.js:617:24)
    at Object.<anonymous> (C:\Users\Kobbi\WebstormProjects\untitled14\index.js:17:18)
    at Module._compile (module.js:428:26)
    at Object.Module._extensions..js (module.js:446:10)
    at Module.load (module.js:353:32)'

I would appreciate any help ,thanks in advance

2 个答案:

答案 0 :(得分:3)

app.on('ready') ...&#39; app&#39;不是你的快递应用程序。 这应该是电子app。

示例:

var app = require('app');
BrowserWindow = require('browser-window');
express = require('express');
expressApp = express();

可以快递使用&#39; app&#39;变量和电子也使用它。

答案 1 :(得分:0)

通常,EADDRINUSE错误意味着您的端口已经被使用(可能是您的快速网络服务器的实例)。也许你的电子应用程序没有正确关闭,你必须手动杀死以杀死正在访问该端口的网络服务器。