因此,我正在尝试部署vue应用,并且为了进行测试,我想切换端口80,以便可以看到没有:8080扩展名的链接。当我这样做时,我会收到致命错误
> node build/dev-server.js
> Starting dev server...
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EACCES 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (net.js:1343:19)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at Function.listen (/Users/Maceto/Desktop/sts/StsSnag/client/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/Users/Maceto/Desktop/sts/StsSnag/client/build/dev-server.js:85:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@1.0.0 start: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@1.0.0 start 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! /Users/Maceto/.npm/_logs/2019-02-28T21_07_27_188Z-debug.log
我不确定自己做错了什么,我在配置文件中更改了端口,但是我明白了。这也只会在端口80上发生。
答案 0 :(得分:2)
你要么要做
sudo node build/dev-server.js
或
sudo setcap 'cap_net_bind_service=+ep' /path/to/nodejs
然后您将无需sudo就可以做到