简体   繁体   English

尝试启动Express应用程序时出现奇怪的node.js错误

[英]Strange node.js error trying to start express app

I can start my app using nodemon, just by typing nodemon 我可以使用nodemon启动我的应用程序,只需键入nodemon

but got below error when I do node app.js 但是当我执行node app.js时出现以下错误

在此处输入图片说明

My package.json is configured properly. 我的package.json配置正确。 It has 它有

"scripts": { "start": "node ./bin/www" }

EADDRINUSE means that a port your node application attempted to bind to, has already been bound to by another process. EADDRINUSE表示您的节点应用程序试图绑定的端口已经被另一个进程绑定。 Typically this suggests you haven't killed your last node process before starting the current one, or you haven't configured your application to use the correct port (eg, a system port that can't be bound to, or a port below 1024 which requires administrative access to bind to). 通常,这表明您没有在启动当前进程之前终止最后一个节点进程,或者尚未将应用程序配置为使用正确的端口(例如,无法绑定的系统端口或1024以下的端口)这需要绑定到管理员权限)。

there is something in use, try to restart your machine and try again. 某些东西正在使用中,请尝试重新启动计算机,然后重试。 =D = D

The port is already in use, there might be another instance of your application already running. 该端口已在使用中,可能您的应用程序的另一个实例已在运行。 To see what processes are running background use netstat -tlpn and to filter node only processes netstat -tlpn | grep node 要查看哪些进程在后台运行,请使用netstat -tlpn并仅过滤节点以netstat -tlpn | grep node netstat -tlpn | grep node . netstat -tlpn | grep node

tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      22917/node          
tcp        0      0 127.0.0.1:8666          0.0.0.0:*               LISTEN      358/node            
tcp        0      0 127.0.0.1:8667          0.0.0.0:*               LISTEN      4416/node  

As you see the port 8081 is already taken, try to kill it and start you server again kill 22917 . 如您所见,端口8081已被占用,请尝试将其杀死,然后再次启动服务器, kill 22917

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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