bwdbooks / learning-angularjs

Code samples for the Learning AngularJS book.
25 stars 23 forks source link

Need to sudo before starting server in ch01 #2

Open ktomazin opened 9 years ago

ktomazin commented 9 years ago

I get the following error when attempting to start the server: bash-3.2$ node server.js events.js:85 throw er; // Unhandled 'error' event ^ Error: listen EACCES at exports._errnoException (util.js:746:11) at Server._listen2 (net.js:1112:19) at listen (net.js:1155:10) at Server.listen (net.js:1240:5) at Function.app.listen (/Users/ken.tomazin/IdeaProjects/learning-angularjs-master 2/node_modules/express/lib/application.js:536:24) at Object. (/Users/ken.tomazin/IdeaProjects/learning-angularjs-master 2/server.js:4:5) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12)

The issue is that we are trying to connect on port 80 and you need to sudo on a unix system before doing that:

sudo node server.js

andyhqtran commented 9 years ago

Check this out. http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo

nmarler commented 8 years ago

I think very similar issue on Windows machine, although different error. Running from an Administrator command prompt:

node server.js events.js:154 throw er; // Unhandled 'error' event ^ Error: listen EACCESS 0.0.0.0:80

Found item below on SO which suggesting using port >1024. I used port 8080 which solved the problem (specifically, edit line 4 of server.js to be: app.listen(8080);)

http://stackoverflow.com/q/35068712/1073908