The sails debug command does not work in Sails.js

I am creating my first sails.js application. When i tried

 sails debug 

I get the following error on the command line

 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 to run

 C:\Windows\system32>netstat -a -n -o 

but, unfortunately, the process is not connected to port 5858. Did I miss something?

I am using Windows 8.1 with node.js v0.12.0 and sails.js 0.11.0

+6
source share
3 answers

My server uses node 0.10.38 with sails due to some weird unfixed thing with 11+. Don't dwell on this question for a while, but there seems to be a new activity ... check out this comment, in particular , which explains the question and a possible fix (direct quote):

Possible Solution:

If you look at the parameters of child_process.fork, the -debug flag is passed to the child when leaving the uterus, that is, Sail debugging works:

 // ./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: [] } ); 
+3
source

Sounds like a bug in Sails. You can apply the fix yourself by replacing the 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 release of Sails v12.

+2
source

Have you tried running debugging like simple node.js?

node --debug app.js

0
source

Source: https://habr.com/ru/post/985323/


All Articles