0

I am using NX for monorepo project together with NestJs. After i run project everything works fien until I do some changes in files and save them. After webapck recompiles project it shows that it is started but has error in console "Starting inspector on localhost:9229 failed: address already in use" and GraphQL studio shows this error: Cannot execute GraphQL operations after the server has stopped for some time. After some time it starts to work again or after second save of files.

Any ideas how to fix it?

1 Answers1

1

This happened because the app process is still open and listening to the port. Normally when you close your app using Ctrl+C it should kill the process also. I suppose it's a bug.

How to fix it the easy way with NodeJS

npx kill-port 9229

How to fix it the not that easy way for Mac/Linux

sudo lsof -i :<PORT>
kill -9 <PID>

How to fix it for Windows users

Open the task manager, look for the process/service using the port and end it using the right click.

Oussama Bouthouri
  • 615
  • 2
  • 8
  • 23