Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

507
Views
How to fix node.js error when trying to execute?

I am starting to work with server side (node.js), and am having some errors when I try to execute it. I am using 127.0.0.1:80 as the server, but I am experiencing some errors when I try to run it.

Console:

Server running at http://127.0.0.1:80/
node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: Listen EACCES: permission denied 127.0.0.1:80
  //at Server.setupListenHandle [as _listen2] (node:net:1363:21)
  at listenInCluster (node:net:1428:12)
  at doListen (node:net:1567:7)
  at processTicksAndRejections (node:internal/process/task_queues:83:21)//
Emitted 'error' event on Server instance at:
  at emitErrorNT (node:net:1407:8)
  at processTicksAndRejections (node:internal/process/task_queues:83:21) {
       code: 'EACCES',
       errno: -13,
       syscall: 'listen',
       address: '127.0.0.1',
       port: 80
 }

Javascript:

 var http = require('http');
 http.createServer(function (req, res) {
   res.writeHead(200, {'Content-Type': 'text/plain'});
   res.end('Hello World\n');
 }).listen(80, '127.0.0.1');
 console.log('Server running at http://127.0.0.1:80/');

package.json:

     {
   "name": "test-web-server",
   "version": "1.0.0",
   "description": "Node.js test server. Use for whatever bs you want to do",
   "main": "index.js",
   "scripts": {
     "start": "node server.js",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "author": "PlazL",
   "license": "ISC"
 }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

a rule of thumb is that listening to ports less than 1024 often requires elevated privileges. Try changing the port to 8080, or elevate your privileges with sudo.

For brevity here is the change in your code:

 var http = require('http');
 http.createServer(function (req, res) {
   res.writeHead(200, {'Content-Type': 'text/plain'});
   res.end('Hello World\n');
 }).listen(8080, '127.0.0.1'); // change port here (80 -> 8080)
 console.log('Server running at http://127.0.0.1:80/');
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!