最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - events.js:72 throw er;Unhandled 'error' event - Stack Overflow

programmeradmin3浏览0评论

I am trying to do on authetication and authorization, from some of the post i found out to install npm, I've install npm too still am unable to solve the error:

$ node blog.js
Blog API is starting on port 6379
 events.js:72
        throw er; // Unhandled 'error' event
              ^

 Error: listen EADDRINUSE
             at errnoException (net.js:904:11)
             at Server._listen2 (net.js:1042:14)
             at listen (net.js:1064:10)
             at Server.listen (net.js:1138:5)
             at Function.app.listen  (./node_modules/express/lib/application.js:531:24)
             at Object.<anonymous> (./api/blog.js:9:5)
             at Module._pile (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)

I am trying to do on authetication and authorization, from some of the post i found out to install npm, I've install npm too still am unable to solve the error:

$ node blog.js
Blog API is starting on port 6379
 events.js:72
        throw er; // Unhandled 'error' event
              ^

 Error: listen EADDRINUSE
             at errnoException (net.js:904:11)
             at Server._listen2 (net.js:1042:14)
             at listen (net.js:1064:10)
             at Server.listen (net.js:1138:5)
             at Function.app.listen  (./node_modules/express/lib/application.js:531:24)
             at Object.<anonymous> (./api/blog.js:9:5)
             at Module._pile (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)
Share Improve this question edited Jun 26, 2020 at 6:16 Kevin Sandow 4,0331 gold badge22 silver badges33 bronze badges asked Jul 2, 2014 at 7:27 zooksanishzooksanish 611 gold badge1 silver badge3 bronze badges 1
  • 2 Error: listen EADDRINUSE means some other program is already listening on the port your server wants to open. – Frédéric Hamidi Commented Jul 2, 2014 at 7:42
Add a ment  | 

1 Answer 1

Reset to default 6

There is an error code in your dump:

EADDRRINUSE which is short for "error address in use" which usually occurs when the port your node.js server ist trying to start is already in use.

Check what port is supposed to be used and figure out what else is already running at that port. It might even be your blog.js you started earlier.


Edit:

Port 6379 is the default port for the redis, which you probably have already ... you should use a different port. If your trying it locally just to start developing and figure out how things works, keep the 3001 and start up a browser at http://localhost:3001/

The Allow-Origin Header should contain the correct hostname under which your server is reachable, as long as your running it locally http://localhost should be fine, a port might be necessary.

发布评论

评论列表(0)

  1. 暂无评论