Cli: [BUG] `sudo npm start` is not enough to listen on port 80 (access denied, EACCES -13)

Created on 23 Oct 2020  路  1Comment  路  Source: npm/cli

Current Behavior:

sudo npm start script which starts http server on port 80 throws an error Error: listen EACCES: permission denied 0.0.0.0:80.

Expected Behavior:


sudo npm start must work without errors.

Steps To Reproduce:

  1. vim ./test.mjs:
import http from 'http';
http.Server().listen(80);
  1. Add a start script to package.json that runs node ./test.mjs
  2. Run sudo npm start and see it fails EACCES -13 (access denied).
  3. Run sudo node ./test.mjs and see it works without errors.

Environment:

  • OS: Linux Mint 20
  • Node: v15.0.1
  • npm: 7.0.3

Did it work before?

Yes, it worked as desired for the previous version of npm (6.x) and NodeJS 14.x.

Bug Needs Triage Release 7.x

Most helpful comment

Same issue occurs

>All comments

Same issue occurs

Was this page helpful?
0 / 5 - 0 ratings