SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Chapter 3 - node auth 8090
-
Nov 25, 2012, 13:09 #1
- Join Date
- Nov 2012
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Chapter 3 - node auth 8090
I have copied the code from page 53 as follows:
Code JavaScript:var dnode = require('dnode'); dnode(function(remote, conn) { this.auth = function(user, pass, cb) { var users = { foo: 'bar' }; var p = users[user]; if (p === pass) cb(null, 'AUTHORIZED!'); else cb('REMOTE ACCESS DENIED'); }; }).listen(process.argv[2]);
When I run the code as instructed node auth 8090 I get the following error
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:769:11)
at Server._listen2 (net.js:909:14)
at listen (net.js:936:10)
at Server.listen (net.js:985:5)
at D.dnode.listen (/Users/test/node_projects/chapter03/node_modules/dnode/index.js:112:16)
at Object.<anonymous> (/Users/test/node_projects/chapter03/dnode/auth.js:11:4)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
What am I doing wrong?
>> I restarted terminal and this code is now working.Last edited by 2learn; Nov 25, 2012 at 13:30. Reason: Nevermind - I've got it sorted out
-
Nov 26, 2012, 18:55 #2
- Join Date
- Nov 2012
- Posts
- 48
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
The following error message
Error: listen EADDRINUSE
Means that the port is already being used. Likely the program was started somewhere else and not terminated correctly
Bookmarks