Heroku Local server doesn't close
This project is for the Heroku CLI only. Use https://help.heroku.com for anything that is not specific to the CLI itself.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
I followed the getting started turotial - i.e. clone the git repo, setup the heroku cli etc.
- I then run
heroku local web - Everything works as expected
- Run
ctrl + cto end the process - Appears to work
- Try to run
heroku local webagain and get error. Server never stopped.
see:
C:\Users\GeorgeEdwards\node-js-getting-started>heroku local web
[OKAY] Loaded ENV .env File as KEY=VALUE Format
8:49:07 PM web.1 | Listening on 5000
[WARN] Interrupted by User
^CTerminate batch job (Y/N)? Y
C:\Users\GeorgeEdwards\node-js-getting-started>heroku local web
events.js:167
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::5000
at Server.setupListenHandle [as _listen2] (net.js:1286:14)
at listenInCluster (net.js:1334:12)
at Server.listen (net.js:1421:7)
at Function.listen (C:\Users\GeorgeEdwards\node-js-getting-started\node_modules\express\lib\application.js:618:24)
at Object.<anonymous> (C:\Users\GeorgeEdwards\node-js-getting-started\index.js:12:4)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
Emitted 'error' event at:
at emitErrorNT (net.js:1313:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
What is the expected behavior?
The local server to close after the ctrl +c is pressed twice and then be free to restart at a later date.
>heroku --version
heroku/7.18.10 win32-x64 node-v11.1.0
When using Windows CMD you can work around this by freeing up the port with the following commands. My example assumes you're using Port 8080
netstat -ano | findstr :8080
The output may vary, but you should see ports matching :8080 currently open with the last number being the PID (Process Identification)
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 7984
TCP [::]:8080 [::]:0 LISTENING 7984
Based on that PID you then run the following command to forcefully close the process
taskkill /PID 7984 /F
Appears this was corrected for my setup with the following CLI version:
heroku/7.19.4 win32-x64 node-v11.3.0
I know this is an old ticket but this still happens all the time with 7.69.1
Is there any way we can get the heroku local to close the server?