简体   繁体   中英

events.js:72 throw er; // Unhandled 'error' event

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._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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM