How can I debug a Sails.js app with node-inspector?
Have you tried using node-webkit to run your node.js apps? This is what we use at work to debug our node.js server applications. It is quite useful runtime based on chromium which you can use to inspect your code using familiar breakpoints, stack traces, variable inspection and such without having to rely on node-inspector (which I find hard to use to be honest).
What you do is instead of using console command 'node you-app.js' you set the node-webkit to launch your app, run the webkit then open its console (which is the same as console in Chrome browser) and from there you can open your source files and start debugging like any other client side JavaScript code.
So you can actually launch a sails
project with node app.js --debug
if you have sails
installed in your project, rather than only system-wide. Go to your project's root directory and run npm install
. Sails should already be in your package.json
and thus should install to your project directory.
sails inspect
since Sails v1.0
As of sails v1.0, sails debug
is deprecated for newer Node.js, and you should instead use sails inspect
.
This is documented at: https://sailsjs.com/documentation/reference/command-line-interface/sails-inspect and is presumably done to match the newer node --inspect
interface.
As of Sails v0.10.x, you can do sails debug
instead of sails lift
.