简体   繁体   中英

What is the reason behind error when I am running npm run dev?

I am running Laravel application with Vuejs & I am running npm run dev & I am getting following error.

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES 0.0.0.0:80
    at Server.setupListenHandle [as _listen2] (net.js:1269:19)
    at listenInCluster (net.js:1334:12)
    at Server.listen (net.js:1421:7)
    at Function.listen (/var/www/frontend/node_modules/express/lib/application.js:618:24)
    at Object.<anonymous> (/var/www/frontend/build/dev-server.js:60:22)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)
Emitted 'error' event at:
    at emitErrorNT (net.js:1313:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@1.0.0 dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2018-10-05T13_47_28_825Z-debug.log

And here is my error log.

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm@6.4.1
3 info using node@v10.10.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle frontend@1.0.0~predev: frontend@1.0.0
6 info lifecycle frontend@1.0.0~dev: frontend@1.0.0
7 verbose lifecycle frontend@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle frontend@1.0.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/frontend/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
9 verbose lifecycle frontend@1.0.0~dev: CWD: /var/www/frontend
10 silly lifecycle frontend@1.0.0~dev: Args: [ '-c', 'node build/dev-server.js' ]
11 silly lifecycle frontend@1.0.0~dev: Returned: code: 1  signal: null
12 info lifecycle frontend@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: frontend@1.0.0 dev: `node build/dev-server.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid frontend@1.0.0
15 verbose cwd /var/www/frontend
16 verbose Linux 3.13.0-100-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v10.10.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error frontend@1.0.0 dev: `node build/dev-server.js`
22 error Exit status 1
23 error Failed at the frontend@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

As I am new to node js terminology, I am not able to understand the error & solve it, can you guys help me in solving this error? Any help will be appreciated.

Many thanks.

A process that listens to ports below 1024 cannot be run without root privileges. Are you using sudo or something similar to ensure that you have correct permissions?

You can either run the command with sudo or setup a reverse proxy. A reverse proxy can be used to start the service on a other port to forward the calls from this port to the new set port.

A reverse proxy is the more reliable and safer option here, but sudo can be used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM