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

"sails debug" on node v0.12.0 throwing error EADDRINUSE #2670

Closed
MikeCostello opened this issue Feb 19, 2015 · 64 comments
Closed

"sails debug" on node v0.12.0 throwing error EADDRINUSE #2670

MikeCostello opened this issue Feb 19, 2015 · 64 comments
Assignees
Labels

Comments

@MikeCostello
Copy link

Running Sails v0.11.0 and Node v0.12.0

When I run

sails new app; cd app
sails debug

Console logs...

error: Grunt :: Error: listen EADDRINUSE
    at exports._errnoException (util.js:746:11)
    at Agent.Server._listen2 (net.js:1129:14)
    at listen (net.js:1155:10)
    at Agent.Server.listen (net.js:1240:5)
    at Object.start (_debugger_agent.js:20:9)
    at startup (node.js:86:9)
    at node.js:814:3

No conflicting ports were listening prior to running sails.
Looking at travis.yml is only node v0.10.x supported currently?

@Kikobeats
Copy link

at this moment sails pass the tests for 0.10.x, so I think that is not possible run your code under 0.12 because is not officially supported...

(Although I do not think that error is the version of node).

@tjwebb
Copy link
Contributor

tjwebb commented Feb 20, 2015

error: Grunt :: Error: listen EADDRINUSE

There's only one way this happens. It's if your port is already being used by another program.

@MikeCostello
Copy link
Author

Agreed, but this is the output just prior to launching sails debug

lsof -i -P | grep -i "listen"

redis-ser  678 mikecostello    4u  IPv6 0x704352d066f66a57      0t0  TCP *:6379 (LISTEN)
redis-ser  678 mikecostello    5u  IPv4 0x704352d06e87f7d7      0t0  TCP *:6379 (LISTEN)
postgres  1604 mikecostello    5u  IPv6 0x704352d066f68357      0t0  TCP localhost:5432 (LISTEN)
postgres  1604 mikecostello    6u  IPv4 0x704352d07074ad67      0t0  TCP localhost:5432 (LISTEN)
postgres  1604 mikecostello    7u  IPv6 0x704352d066f66f57      0t0  TCP localhost:5432 (LISTEN)
GitHub    8261 mikecostello   15u  IPv4 0x704352d07dc24d67      0t0  TCP localhost:25035 (LISTEN)
GitHub    8261 mikecostello   16u  IPv6 0x704352d066f67957      0t0  TCP localhost:25035 (LISTEN)

After running sails debug the debug port is opened and I can connect with node-inspector. Just the error is logged in the console.

Node v0.10 & Sails v0.11 works
Node v0.12 & Sails v0.10.5 same error

@tjwebb
Copy link
Contributor

tjwebb commented Feb 20, 2015

Hmm. It's also not clear to me why the error appears to come from Grunt, and not the debugger. Can you disable Grunt and try again?

@MikeCostello
Copy link
Author

With Grunt disabled no error

@wewoor
Copy link

wewoor commented Feb 28, 2015

I have the same problem, how to solve it... console will output Error: listen EADDRINUSE When i'm run

node-debug app.js

,And the Node Inspector not work correctly.

My node version:v0.12.0
sails: v0.10.5

it's too bad not this tool.

@Patrick64
Copy link

I'm getting the same, it prevents assets from copying to .tmp/public. I've tried changing the ports as follows but it's still giving the error.
node-debug --debug-port=3333 --web-port=4444 app.js

@nicco
Copy link

nicco commented Mar 5, 2015

Sails 0.11:

node 0.10 -> works
node 0.11 -> EADDRINSUSE
node 0.12 -> EADDRINSUSE

@konstantinzolotarev
Copy link
Member

+1 for this issue.

@nehalmehta
Copy link

Same issue when running Sails v0.11.0 and Node v0.12.0

As nicco has mentioned it works in Node V0.10.0

@salmankhann
Copy link

I seem to have the same problem... Anyone found a fix yet?

@nicco
Copy link

nicco commented Mar 18, 2015

Node 0.10.x
Is the only option

On Wed, Mar 18, 2015, 17:56 chemjournal notifications@github.com wrote:

I seem to have the same problem... Anyone found a fix yet?


Reply to this email directly or view it on GitHub
#2670 (comment).

@MikeCostello
Copy link
Author

@tjwebb comment disabling grunt avoids the error if your project doesn't need that hook.

http://sailsjs.org/#!/documentation/anatomy/myApp/sailsrc.html

{
 "hooks": {
    "grunt": false
  }
}

@DrMoriarty
Copy link

+1 for this issue.

node --version
v0.12.0

sails --version
0.10.0-rc8

@bmwertman
Copy link

Any new info on this? I am getting the same error.

node --version
v0.12.0

sails --version
0.11.0

Perhaps unrelated I'm also seeing an error in the node-inspector console;

Error: Cannot find module '/Users/Brad/.npm-packages/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.4.2/node-v14-darwin-x64/debug.node'

@bmwertman
Copy link

npm cache clean and npm install node-inspector as mentioned here fixed the "cannot find module" error. But I'm still seeing the EADDRINUSE error as everyone else.

@willSonic
Copy link

I am using Gulp, using sails-generator and I am getting the same error..
error: Gulp :: Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Agent.Server._listen2 (net.js:1129:14)
at listen (net.js:1155:10)
at Agent.Server.listen (net.js:1240:5)
at Object.start (_debugger_agent.js:20:9)
at startup (node.js:86:9)
at node.js:814:3

@tjwebb
Copy link
Contributor

tjwebb commented Mar 23, 2015

can someone share a project I can clone to see this in action? I cannot reproduce this

@WillStreeter
Copy link

So I pushed this to a repository even though it is not a fully functional site...

https://github.com/WillStreeter/ang-sails-gulp

error: Gulp :: Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Agent.Server._listen2 (net.js:1129:14)
at listen (net.js:1155:10)
at Agent.Server.listen (net.js:1240:5)
at Object.start (_debugger_agent.js:20:9)
at startup (node.js:86:9)
at node.js:814:3

I am starting Sails from WebStorm and before it loads I see the above error.

I am using

--$ node -v
v0.12.0
--r$ sails -v
0.11.0

@tjwebb
Copy link
Contributor

tjwebb commented Mar 23, 2015

cloned, npm install, works great:

$ tjwebb@latitude:/.../tjwebb/workspace/ang-sails-gulp (master) $ sails lift

info: Starting app...

info: 
info:                .-..-.
info: 
info:    Sails              <|    .-..-.
info:    v0.11.0             |\
info:                       /|.\
info:                      / || \
info:                    ,'  |'  \
info:                 .-'.-==|/_--'
info:                 `--'-------' 
info:    __---___--___---___--___---___--___
info:  ____---___--___---___--___---___--___-__
info: 
info: Server lifted in `/home/tjwebb/workspace/ang-sails-gulp`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.

debug: --------------------------------------------------------
debug: :: Sun Mar 22 2015 23:24:04 GMT-0400 (EDT)

debug: Environment : development
debug: Port        : 1337
debug: --------------------------------------------------------
^C
$ node -v
0.10.37
$ sails -v
0.11.0

@WillStreeter
Copy link

so you are using
$ node -v
0.10.37

I was using node 0.12.0

@tjwebb
Copy link
Contributor

tjwebb commented Mar 23, 2015

Just tried with node 0.12.0 and iojs 1.6.1 and both work.

@tjwebb
Copy link
Contributor

tjwebb commented Mar 23, 2015

Oh I get it, sails debug doesn't work. So yea, sails debug works for me with 0.10.37 but not 0.12.

Crazy idea: maybe the newer version of node sees debug on the command-line and tries to fire up a separate debugger instance?

@WillStreeter
Copy link

Yes.. I was just about to reply that I think that this is the issue because when I run it from the command line with a straight ... sails lift .. no problems occur but when I run it from the IDE for debugging the error appears

@tjwebb
Copy link
Contributor

tjwebb commented Mar 23, 2015

Yea, check this out:

  1. $ nmap -sV 127.0.0.1 -p 5858 says port is closed
  2. run sails debug. errors out, but don't close
  3. $ nmap -sV 127.0.0.1 -p 5858 says the port is open, as if sails debug is working.
  4. previous nmap command causes sails debug to crash with Error: write EPIPE

So the debugger is actually running. Try running node debug app.js instead and see if that works. Looks like sails debug needs to be re-tooled.

@WillStreeter
Copy link

So when I run it from webstorm IDE
with parameter debug... I get

/usr/local/bin/node --debug-brk=53032 --nolazy debug app.js
Debugger listening on port 53032
debug> �< Debugger listening on port 5858
debug> �connecting to port 5858... ok
debug> �break in app.js:55
� 53 // Start server
� 54 sails.lift(rc('sails'));
�>55 })();
� 56
� 57 });
debug>

seems like the closure in app.js is getting jacked...

// Start server
sails.lift(rc('sails'));
})();

@KSanthanam
Copy link

I am running node -v 0.12.0
I get the following error
Error: Cannot find module '/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.4.2/node-v14-darwin-x64/debug.node

on the console of the browser. when I run

node-debug --debug-brk --harmony --use-strict app.js

on Mac terminal I get

Node Inspector is now available from http://127.0.0.1:8080/debug?port=5858
Debugger listening on port 5858

Starting the interactive shell (REPL). Type .help for help.
The module in the current directory was not loaded: Cannot find module '/Users/KK/git/DNetworksAuth'.
Didn't want to start REPL? Run /usr/local/bin/node-debug . instead.

I need to run node 0.11.x or above as I am using Web framework koa which needs it.

Please help.

@felipecm
Copy link

+1

2 similar comments
@sirsavary
Copy link

+1

@JameelJiwani
Copy link

+1

@tjwebb
Copy link
Contributor

tjwebb commented Apr 28, 2015

Yea it's a known issue. Anyone who has time to submit a PR would be greatly appreciated.

@dapriett
Copy link
Member

After reading the comments from the io.js issue (nodejs/node#877) I was able to get debug working with Intellij.

To do so you have to install the early EAP release of Intellij (see comments of https://youtrack.jetbrains.com/issue/WEB-16256#comment=27-979926). Once installed go to
Help > Find Action... > Registry and uncheck the option "js.debugger.v8.use.any.breakpoint".

This fixed it for me, and the debugger loads up real quick now.

I still get the "Error: listen EADDRINUSE" issue though, but that doesn't bother me as much as the hanging, with "The hook ... is taking too long to load."

@dbuentello
Copy link
Contributor

PR submitted @tjwebb

@tjwebb
Copy link
Contributor

tjwebb commented Apr 29, 2015

awesome @dbuentello thanks for the PR. I'll take a look.

@bmustata
Copy link

Switched back to node v0.10.38 and all works Ok!

node -v
v0.10.38
npm -v
2.5.1

@thomas-lee
Copy link

That's fix doesn't work..

node -v
v0.12.2
sails -v
0.11.0

@aabluedragon
Copy link

+1 having the same issue on node 0.12, works fine on 0.10

@SlowburnAZ
Copy link

Please fix this... do we really have to use a version of node that is 2 versions behind the latest?

@tjwebb
Copy link
Contributor

tjwebb commented May 22, 2015

@SlowburnAZ if you'd like to contribute to the PR for resolving this issue, that'd be much appreciated: #2888. The core team cannot implement every fix and feature ourselves, we rely on the community to collaborate with us. Thanks.

@SlowburnAZ
Copy link

@tjwebb If I can find the time, I will attempt it.

@denishgandhi-innoplexus

Hi,

I am getting same error.

info: Server lifted in /var/www/Sails
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press + C at any time.

debug: --------------------------------------------------------
debug: :: Tue May 26 2015 03:30:23 GMT+0530 (IST)

debug: Environment : development
debug: Port : 1337
debug: --------------------------------------------------------

events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at Server.listen (net.js:1135:5)
at Array.async.auto.start as 0
at /var/www/Sails/node_modules/sails/node_modules/async/lib/async.js:484:38
at _each (/var/www/Sails/node_modules/sails/node_modules/async/lib/async.js:46:13)
at Object.async.auto (/var/www/Sails/node_modules/sails/node_modules/async/lib/async.js:455:9)
at Sails.startServer (/var/www/Sails/node_modules/sails/lib/hooks/http/start.js:16:11)
at Sails.EventEmitter.emit (events.js:92:17)
at Sails.emitter.emit (/var/www/Sails/node_modules/sails/lib/app/private/after.js:50:11)
at afterBootstrap (/var/www/Sails/node_modules/sails/lib/app/private/initialize.js:56:11)
at bootstrapDone (/var/www/Sails/node_modules/sails/lib/app/private/bootstrap.js:51:14)
at Object.module.exports.bootstrap (/var/www/Sails/config/bootstrap.js:16:3)
at Sails.runBootstrap (/var/www/Sails/node_modules/sails/lib/app/private/bootstrap.js:44:25)
at Sails.bound as runBootstrap

node -v
v0.10.25
sails -v
0.11.0

Please provide the solution.

@denishgandhi-innoplexus

Got it worked by killing process which runs 1337/tcp

sudo fuser -k 1337/tcp
sudo kill 3501

@Andrew-Max
Copy link

+1

@shaunc
Copy link

shaunc commented Jul 8, 2015

+1 for fix!

node 0.12.4 ... tried hacking fork per @dbuentello's suggestion ... "works a little" -- ie now I get the error, but if I just wait the debugger somehow limps along, but it acts strangely (e.g. no access to local context in repl).

@FreCap
Copy link

FreCap commented Jul 24, 2015

+1 for fix

@sgress454
Copy link
Member

Any chance this fixes it? It just got merged: #2888

Someone mind pulling down the latest master branch of Sails and testing?

@sgress454
Copy link
Member

Confirmed working on Node v0.12.7 with the latest Sails patches applied. Post back here if anyone sees different.

@dapriett
Copy link
Member

@sgress454 I upgraded to node 0.12.7 - so do we need to wait for sails 0.12.0 release before we see the fix? Looks like it still does it with sails 0.11.0.

@sgress454
Copy link
Member

@dapriett right--the fix was merged in to the master branch in 88ffc0e, but hasn't been published yet. We were hoping to get v0.12 out this month but got sidetracked by some non-Sails matters. Definitely want to get it out ASAP. In the meantime installing from Github should fix it.

@ksylvan
Copy link

ksylvan commented Aug 7, 2015

+1 same issue for me.

Sails 0.11.0 and node 0.12.7 with node-inspector 0.12.2.

@wassimsalib
Copy link

+1 Same issue Sails 0.11.0, Node 0.12.7 and node-inspector 0.11.1

@misterch0c
Copy link

+1 but for me it happened with "sails lift", this is how I solved it

unkn0wn@archie{~/web/betsails}:lsof -i:1337
COMMAND  PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
node    5961 unkn0wn   27u  IPv6 234934      0t0  TCP *:menandmice-dns (LISTEN)
node    5961 unkn0wn   28u  IPv6 234938      0t0  TCP localhost.localdomain:menandmice-dns->localhost.localdomain:47931 (CLOSE_WAIT)
node    5961 unkn0wn   30u  IPv4 234946      0t0  TCP localhost.localdomain:34789->localhost.localdomain:menandmice-dns (ESTABLISHED)
node    5961 unkn0wn   33u  IPv6 234949      0t0  TCP localhost.localdomain:menandmice-dns->localhost.localdomain:34789 (ESTABLISHED)
unkn0wn@archie{~/web/betsails}:kill -9 5961
unkn0wn@archie{~/web/betsails}:lsof -i:1337
[1]+  Killed                  sails lift
unkn0wn@archie{~/web/betsails}:sails lift

info: Starting app...

info: 
info:                .-..-.
info: 
info:    Sails              <|    .-..-.
info:    v0.11.0             |\
info:                       /|.\
info:                      / || \
info:                    ,'  |'  \
info:                 .-'.-==|/_--'
info:                 `--'-------' 
info:    __---___--___---___--___---___--___
info:  ____---___--___---___--___---___--___-__
info: 
info: Server lifted in `/home/unkn0wn/web/betsails`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.

@sgress454
Copy link
Member

Ladies and gentlemen, I'm locking this issue. It's been solved. We'll push out v0.12 as soon as we can, but putting +1 here just obscures the fact that a patch has been made. You can apply it yourself by replacing your Sails' /lib/hooks/grunt/index.js file with the contents of https://raw.githubusercontent.com/balderdashy/sails/88ffc0ed9949f8c74ea390efb5610b0e378fa02c/lib/hooks/grunt/index.js; this is the file that will be in the next release, so it's safe to use now.

@balderdashy balderdashy locked and limited conversation to collaborators Aug 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests