我遵循了Getting Started on Heroku with Node.js教程。
我曾经能够运行heroku local
。但是,在完成一些作业并更改一些代码后,我现在得到以下错误:
12:01:48 p.m. web.1 | node:events:505
12:01:48 p.m. web.1 | throw er; // Unhandled 'error' event
12:01:48 p.m. web.1 | ^
12:01:48 p.m. web.1 | Error: listen EADDRINUSE: address already in use :::5000
我甚至按照教程中完全相同的步骤创建了一个新的应用程序,但它仍然显示了这个错误。
以下是完整的错误:
filipomarcellino@Filipos-MacBook-Air cmpt276-filipo % heroku local
[OKAY] Loaded ENV .env File as KEY=VALUE Format
12:01:47 p.m. web.1 | > node-js-getting-started@0.3.0 start
12:01:48 p.m. web.1 | > node index.js
12:01:48 p.m. web.1 | node:events:505
12:01:48 p.m. web.1 | throw er; // Unhandled 'error' event
12:01:48 p.m. web.1 | ^
12:01:48 p.m. web.1 | Error: listen EADDRINUSE: address already in use :::5000
12:01:48 p.m. web.1 | at Server.setupListenHandle [as _listen2] (node:net:1372:16)
12:01:48 p.m. web.1 | at listenInCluster (node:net:1420:12)
12:01:48 p.m. web.1 | at Server.listen (node:net:1508:7)
12:01:48 p.m. web.1 | at Function.listen (/Users/filipomarcellino/cmpt276-filipo/node_modules/express/lib/application.js:635:24)
12:01:48 p.m. web.1 | at Object.<anonymous> (/Users/filipomarcellino/cmpt276-filipo/index.js:10:4)
12:01:48 p.m. web.1 | at Module._compile (node:internal/modules/cjs/loader:1105:14)
12:01:48 p.m. web.1 | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
12:01:48 p.m. web.1 | at Module.load (node:internal/modules/cjs/loader:981:32)
12:01:48 p.m. web.1 | at Function.Module._load (node:internal/modules/cjs/loader:822:12)
12:01:48 p.m. web.1 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
12:01:48 p.m. web.1 | Emitted 'error' event on Server instance at:
12:01:48 p.m. web.1 | at emitErrorNT (node:net:1399:8)
12:01:48 p.m. web.1 | at processTicksAndRejections (node:internal/process/task_queues:83:21) {
12:01:48 p.m. web.1 | code: 'EADDRINUSE',
12:01:48 p.m. web.1 | errno: -48,
12:01:48 p.m. web.1 | syscall: 'listen',
12:01:48 p.m. web.1 | address: '::',
12:01:48 p.m. web.1 | port: 5000
12:01:48 p.m. web.1 | }
[DONE] Killing all processes with signal SIGINT
12:01:48 p.m. web.1 Exited with exit code null
1条答案
按热度按时间f0brbegy1#
根据您问题中的错误消息,
heroku local
正尝试在端口5000
上运行您的应用,但该端口已被另一个进程占用。您可以使用
-p
标志在不同的端口上运行应用,如下所示:有关
heroku local
命令可用的其他选项,请参阅Heroku Dev Center的“在本地运行应用〉在本地启动应用”部分。