最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

nextjs app:Error: listen EACCES: permission denied 0.0.0.0:80

网站源码admin38浏览0评论

nextjs app:Error: listen EACCES: permission denied 0.0.0.0:80

nextjs app:Error: listen EACCES: permission denied 0.0.0.0:80

我在端口 80 上运行 nextjs 应用程序时出错。

这是我的 package.json

"scripts": {
    "dev": "next dev -p 80",
}

运行 yarn dev 时出现错误

error - Failed to start server
Error: listen EACCES: permission denied 0.0.0.0:80
    at Server.setupListenHandle [as _listen2] (node:net:1415:21)
    at listenInCluster (node:net:1480:12)
    at Server.listen (node:net:1568:7)
    at D:\MCP\monorepo\node_modules\next\dist\server\lib\start-server.js:144:16
    at new Promise (<anonymous>)
    at Object.startServer (D:\MCP\monorepo\node_modules\next\dist\server\lib\start-server.js:129:11)
    at setupFork (D:\MCP\monorepo\node_modules\next\dist\cli\next-dev.js:337:65)
    at runDevServer (D:\MCP\monorepo\node_modules\next\dist\cli\next-dev.js:348:23)
    at async nextDev (D:\MCP\monorepo\node_modules\next\dist\cli\next-dev.js:457:9) {
  code: 'EACCES',
  errno: -4092,
  syscall: 'listen',
  address: '0.0.0.0',
  port: 80
}
error Command failed with exit code 1.

我的nodejs版本:v16.17.0

我的电脑规格:

Edition Windows 10 Pro
Version 22H2
Installed on    ‎4/‎22/‎2021
OS build    19045.2846
Experience  Windows Feature Experience Pack 120.2212.4190.0

任何人都可以给我解决方案来运行应用程序而无需更改端口。非常感谢

回答如下:

1024以下的端口号是特权端口(在这种情况下,80< 1024). You have to run your command using Administrator privilege (Windows) /

sudo
(Unix)或更改为其他端口(建议更改端口)。

如果您了解风险并在此处使用 WSL,您可以尝试使用

sudo yarn dev

运行它
发布评论

评论列表(0)

  1. 暂无评论