I am creating my first sails.js
app. When I tried
sails debug
I'm getting the following error on my command prompt
Debugger listening on port 5858
info: Starting app...
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
To get the PID of the process using port:5858, I tried running
C:\Windows\system32>netstat -a -n -o
but unfortunately there is no process bound to port 5858. Am I missing something here?
I'm using Windows 8.1 with node.js
v0.12.0
and sails.js
0.11.0
My server uses node 0.10.38 with sails because of some weird unfixed grunt thing with 11+. Haven't pulled up this issue in a while, but it looks like there's new activity... check out this comment in particular, which explains the issue and a possible fix (direct quote):
Possible Solution:
Looking at the options for child_process.fork, the --debug flag is being passed down to the child upon exiting the womb i.e. running sails debug :
// ./node_modules/sails/bin/sails-debug.js // Spin up child process for Sails Womb.spawn('node', ['--debug', pathToSails, 'lift'], { stdio: 'inherit' });
setting options.execArgv to an empty array removes the flag and allows the process to continue:
// ./node_modules/sails/lib/hooks/grunt/index.js var child = ChildProcess.fork( path.join(__dirname, 'grunt-wrapper.js'), [ taskName, '--pathToSails='+pathToSails, '--gdsrc='+ pathToSails + '/node_modules' ], { silent: true, stdio: 'pipe', execArgv: [] } );
It seems like a bug in Sails. You can apply the fix your self by replacing your Sails' file:
./node_modules/sails/lib/hooks/grunt/index.js
with the contents of the following:
https://raw.githubusercontent.com/balderdashy/sails/88ffc0ed9949f8c74ea390efb5610b0e378fa02c/lib/hooks/grunt/index.js
This is the file that will be in the Sails' release v12.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With