nodejs应用无法启动:error listen EACCES: permission denied 127.0.0.1:3000

技术运维Node.js 109

nodejs无法启动出现端口错误:

$ astro dev
 error   listen EACCES: permission denied 127.0.0.1:3000
Error: listen EACCES: permission denied 127.0.0.1:3000
    at Server.setupListenHandle [as _listen2] (node:net:1355:21)
    at listenInCluster (node:net:1420:12)
    at GetAddrInfoReqWrap.doListen [as callback] (node:net:1559:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

解决办法:

用管理员权限运行cmd,然后依次输入:

  1. net stop winnat
  2. net start winnat
C:\Windows\System32>net stop winnat

The Windows NAT Driver service was stopped successfully.


C:\Windows\System32>net start winnat

The Windows NAT Driver service was started successfully.

在重新启动node应用即可。

Post Comment