javascript - 端口未释放(nodemon)
问题描述
我正在使用 nodemon 重新加载我的服务器,但是当我保存文件时它会抛出一个错误,它说该端口已经被另一个进程使用。
这是错误:
events.js:174
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (net.js:1280:14)
at listenInCluster (net.js:1328:12)
at Server.listen (net.js:1415:7)
at Function.listen (/home/yamil/code/tasksApp/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/yamil/code/tasksApp/index.js:23:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Emitted 'error' event at:
at emitErrorNT (net.js:1307:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
[nodemon] app crashed - waiting for file changes before starting...
pd:我使用的是 Ubuntu 20.04.2
解决方案
使用此命令终止侦听端口的所有程序:
lsof -ti tcp:3000 | xargs kill
推荐阅读
- vue.js - 嵌套路由不遵循定义的模式。VUEjs
- python - Telegram Webhook 不会从群聊中发送文本
- sql - 在从字符串列拆分的多个列上连接两个表
- linux - 如何使用 grep/egrep 对包含“字符串”的子目录中的文件进行计数
- c# - 如何使用 UnixDomainSocketEndPoint 在 dotnet 中创建 unix 套接字?
- python - 错误('连接中止。',ConnectionResetError(10054,'现有连接被远程主机强行关闭',无,10054,无))
- amazon-elastic-beanstalk - 你能在`eb setenv`上触发一个shell脚本吗?
- php - 如果已经在 IIS 中启用,我是否需要在 PHP 中启用 gzip 压缩?
- vba - 如果之前关闭单词,VBA 文档计数将失败
- django - 我们如何为一个杂志添加超过 3 个作者字段?在 Django 模型中