利用koa2创建前端服务器,运行时报错Error: listen EACCES: permission denied http://127.0.0.1:8888?
Node.js v18.16.0[nodemon] app crashed - waiting for file changes before starting...
[nodemon] restarting due to changes...
[nodemon] starting `node app.js`
node:events:491
throw er; // Unhandled 'error' event
^
Error: listen EACCES: permission denied http://127.0.0.1:8888
at Server.setupListenHandle [as _listen2] (node:net:1723:21)
at listenInCluster (node:net:1788:12)
at Server.listen (node:net:1887:5)
at Application.listen (/Users/yangqing/koa_serve/node_modules/koa/lib/application.js:88:19)
at Object.<anonymous> (/Users/yangqing/koa_serve/app.js:14:5)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1767:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'EACCES',
errno: -13,
syscall: 'listen',
address: 'http://127.0.0.1:8888',
port: -1
}
回答:
格式不对;
app.listen(8888, '127.0.0.1', () => { console.log('Server is running on http://127.0.0.1:8888');
});
回答:
是不是8888端口被系统模块占用了?
你检查下
参考https://blog.csdn.net/weixin_43389832/article/details/119733382
以上是 利用koa2创建前端服务器,运行时报错Error: listen EACCES: permission denied http://127.0.0.1:8888? 的全部内容, 来源链接: utcz.com/p/934205.html