Project>N..." /> Project>N..." /> Project>N..."/>

Can't run simple Node Express App in Eclipse using Nodeclipse. Get Console message of "<terminated, exit value: 0>Node.js Process"

1.5k views Asked by At

Can't run simple Node Express App in Eclipse using Nodeclipse. Get Console message of "Node.js Process"

Fresh install. Any suggestions

New>Project>Node Express Right Click App.js Run As Node Application

Eclipse Version for JAVA and Reporting: Luna Service Release 1 (4.4.1)
Nodeclipse Core and Node.js 0.17.0.201409260936
MAC OSX 10.10.1 (14B25) 64bit
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
1

There are 1 answers

0
Marc Cayuela On

When Nodeclipse creates a new Express project (with express version >4.0) it misses to start the server so it listens to a certain port (that's why it finishes without any error).

In order for it to work you should add at the end of your app.js file this:

app.listen(3000, function () {
  console.log('App listening on port 3000!');
});

In the previous versions of express the equivalent is:

http.createServer(app).listen(app.get('port'), function(){
   console.log('Express server listening on port ' + app.get('port'));
});