Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listen EADDRINUSE: address already in use :::4000 #84

Open
jcast90 opened this issue Mar 16, 2020 · 6 comments
Open

listen EADDRINUSE: address already in use :::4000 #84

jcast90 opened this issue Mar 16, 2020 · 6 comments

Comments

@jcast90
Copy link

jcast90 commented Mar 16, 2020

I've been using for the past few months and it's been awesome! However, I probably haven't used it in the past month or 2, when I came back to start a new project I keep getting this error when running slater watch:

Error: listen EADDRINUSE: address already in use :::4000 at Server.setupListenHandle [as _listen2] (net.js:1301:14) at listenInCluster (net.js:1349:12) at Server.listen (net.js:1437:7) at Object.watch (/Users/usr/Desktop/freelance/new-store/node_modules/@slater/compiler/index.js:81:10) at watch (/Users/user/Desktop/freelance/new-store/node_modules/slater/index.js:222:25) Emitted 'error' event on Server instance at: at emitErrorNT (net.js:1328:8) at processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'EADDRINUSE', errno: 'EADDRINUSE', syscall: 'listen', address: '::', port: 4000 }

I tried doing removing any other global slater installs and re-installed everything and tried with a brand new store and still am getting this issue. When I try and run lsof -ti:4000 it's not showing anything is running on this port. Has anyone else had issues with this or found a solution?

Again, awesome job on this project, it makes shopify dev so much more convenient!

OS: Catalina 10.15.3
Node: 12.14.0
npm: 6.13.4
Slater: 1.7.0

@jcast90
Copy link
Author

jcast90 commented Mar 16, 2020

UPDATE: I was able to resolve this by going to node_modules/@slater/compiler/index.js and changing the port to 4040. This is a temporary fix, again not sure if anybody else is having this issue, but the watch command seems to conflict with some other command being ran on port 4000. Should the commands be running on separate ports, or maybe add in a condition to check if something conflicts with another port then it'll just run on the next open port?

@iamkevingreen
Copy link
Member

@jcast90 I haven't encountered this issue particularly with slater, but I have encountered my system not closing other ports (gatsby sites, netlify dev etc). I use an npm package called fkill to close specific ports running. Might be a bandaid to a system problem but it works for my purposes

@kith-and-kin
Copy link

This often happens when a process running on that particular port hasn't terminated properly.
The fact that it's port 4000 being used means it's more than likely just from a previous time you've spun up Slater and perhaps it's crashed, or not been shut down correctly.

In terminal write:

sudo lsof -i :4000

This finds all processes running on that port.
You'll see a column called PID. Find the PID that seems to be causing the issue then run:

kill -15 PID (replacing PID in that command with the actual PID).

This should stop the process that's running on that port and allow you to spin Slater back up.

@jcast90
Copy link
Author

jcast90 commented Apr 17, 2020

@iamkevingreen @kith-and-kin Thanks for the responses! I did that and killed all process running on that port. What seems to be happening is it runs on that port and fails or something but continues to run? So I first check if anything is running on port 4000, nothing shows up, then when I run it, it shows that error, then I check again if anything is running on that port, kill it, then run it again but same error. So bizarre. Might close this if no one else is experience this issue.

@kith-and-kin
Copy link

No worries! It's probably worth leaving it open for now, as there is another issue reported here #37, so there's probably some substance.

@Mohammed-Elkhamlichi
Copy link

just exit from the current terminal and open an other one and this problem will solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants