我正在创建我的第一个 sails.js
应用程序。当我尝试
sails debug
我在命令提示符下收到以下错误
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
为了获取使用端口:5858 的进程的 PID,我尝试运行
C:\Windows\system32>netstat -a -n -o
但不幸的是,没有进程绑定(bind)到端口 5858。我在这里遗漏了什么吗?
我在 Windows 8.1 中使用 node.js
v0.12.0
和 sails.js
0.11.0
最佳答案
我的服务器使用 Node 0.10.38 和 sails 因为 11+ 有一些奇怪的未修复的咕噜声。有一段时间没有提出这个问题,但看起来有新的事件......查看this comment in particular ,它解释了问题和可能的修复(直接引用):
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: [] } );
关于javascript - sails 调试命令在 Sails.js 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29692155/