11

How to run meteor on a different port, for example on port 80. I tried to use meteor --port 80, but I get this error Error: listen EACCES

help me please.

mihai
  • 37,072
  • 9
  • 60
  • 86
Widada
  • 575
  • 2
  • 4
  • 17

4 Answers4

13

Sounds like it might be access issue on your machine.

Check out this following answer, which might be related to your question. Quoting:

"As as a general rule processes running without root privileges cannot bind to ports below 1024.

So try a higher port, or run with elevated privileges via sudo."

So, you can see that sudo meteor run with your port number will work, but that you can address the root cause, which is fixing the node root privilege.

Node.js EACCES error when listening on most ports

Community
  • 1
  • 1
David Kim
  • 866
  • 9
  • 11
10

You can't bind to ports < 1024 on Linux/Unix operating systems with a non-privileged account.

You could get around this by running meteor as root, but this is a really bad idea. In development mode, running as root will modify the permissions of the files under your application directory. In production, it's just a giant security hole. Never run a meteor app as root.

Listed below are the best practices depending on your environment.

Development

Run meteor on a high port number. The default is 3000 when you don't give a --port argument. Connect to it via the URL printed in the console - e.g. http://localhost:3000/.

Production

Here you have two choices:

  • Run meteor on a high port number and connect it to the outside world via a reverse proxy like nginx or HAProxy.

  • Start the webserver as root but step down the permissions once it's running using something like userdown. This is how mup works which, incidentally, is probably what you should be using to deploy your app.

Community
  • 1
  • 1
David Weldon
  • 63,632
  • 11
  • 148
  • 146
5

The meteor run --port 8080 terminal command can be used.

eapo
  • 1,053
  • 1
  • 19
  • 40
3

run it with sudo

sudo meteor --port 80
Mustafa
  • 1,738
  • 2
  • 24
  • 34
  • Its a huge security leak to run it with sudo. I'd give -10 for such "solutions"... – Paweł Smołka Jul 24 '16 at 10:24
  • @PawełSmołka Can you explain me how it is security leak with sudo as I am newbie to ubuntu.Thanks – Sai Ram Oct 06 '16 at 05:20
  • 2
    For example: If someone will hack your webapp he may gain root access to your server and call system commands remotely. I am also not an allmighty expert but I am very carefull about running with root rights any app with public access... – Paweł Smołka Oct 06 '16 at 17:20
  • 1
    Meteor installs on your local user and running on sudo will probably won't work or have unintended consequences, -10. – Erez Hochman Aug 12 '21 at 17:30