events.js: 72 error - Error running my first global app with express

2

I did the global express installation on Ubuntu (and my Mac too) using

npm install -g express 

Then I created my app using the command:

express -se hello_express

I went into the application directory and typed:

npm install

When I try to run the node using the

node app.js

it accuses the following error:

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: listen EADDRINUSE
  at errnoException (net.js:901:11)
  at Server._listen2 (net.js:1039:14)
  at listen (net.js:1061:10)
  at Server.listen (net.js:1135:5)
  at Object.<anonymous> (/caminho_da_aplicacao/hello_express/app.js:36:24)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)

I'm starting now with "node + express", so I wonder if someone has already gone through this, if I'm doing something wrong and how do I resolve it.

    
asked by anonymous 18.02.2014 / 15:34

1 answer

2
Error: listen EADDRINUSE

The port that the expression is going to use is already in use, choose another: the port is defined by this line app.set('port', process.env.PORT || 3000); no app.js, logo change the variable PORT .

As shown on this StackOverflow question you will also encounter this error when you unexpectedly close your app, which is the chance of the application to release the doors. If this is your case there are the answers.

    
18.02.2014 / 16:16