Node.js debugging/console?


#1

I’ve been using WebStorm, but quite like my experience with Atom so far, though when it comes to Node.js projects I’m not sure if I can transition easily? How are you debugging and getting console feedback from node? Is there an easy way to control the node app?

In webstorm you could either use key shortcuts or press buttons that would run/restart/stop the node process and likewise for debugging step in, step out/over, errors provided another tab with stack traces that linked back to the appropriate file/line.

There is also a terminal/console for things like npm, gulp, etc. I’m aware of terminal packages and have tried a few out that haven’t worked out too well so far, still looking into the others, as I need to run admin/elevated terminal sometimes I’ll probably use an external terminal such as ConEmu/CMDer. I’m assuming debug tools need to be run through a terminal, though not sure how to get breakpoints and other features working from Atom.


#2

Two terminal packages term2 and termrk fail to install, the error message links to this issue: https://github.com/atom/settings-view/issues/577

Performed apm install for each in the console, pty.js which they both depend on fails to build with node-gyp.

terminal-status, terminal-panel(fork of terminal-status), and atom-terminal-panel(fork of terminal-panel) both provide a nice terminal but unlike a cmd, webstorm or others I’ve used ‘vagrant ssh’ blocks any input after being run.

quantum-shell states windows support isn’t great, I might have to do some sort of setup as trying to run any command just returns ‘!!Error: spawn /bin/sh/ ENOENT’

atom-terminal just opens a regular cmd at the project location, seem to be able to configure this to CMDer/ConEmu, but my issue with this package is it opens not one cmd but two(Github issue).

run-in-terminal seems to achieve the same as atom-terminal minus the bug, still no idea how to debug via Atom though?


#3

Not atom related, but have you tried node-inspector? As a previous webstorm user myself, node-inspector works well for me as a debug tool.


#4

Have you tried termrk? Works great on Linux, don’t know about windows though…


#5

@mnort9 I haven’t, I’ll give it a look thanks.

@olmokramer I’ve tried it and mentioned it in my post above, it looks good but won’t install on windows, node-gyp fails to build pty.js :frowning:


#6

Are you by any chance running as root? Node-gyp will fail unless you run npm with the --unsafe option.


#7

The sudo equivalent on windows being ‘Run as Administrator’ I’ve done that on Atom and via running an elevated terminal. Doesn’t help. I’m not sure how to run npm --unsafe when trying to install this package via Atom/apm, is there an apm --unsafe? ‘apm install term2’


#8

I know a way that works but there is probably a more correct way.

  • Get the package from the repo with git clone. Clone into your packages folder.
  • Use npm install --unsafe in the root of the project folder
  • run apm install in the same place afterwards.

#9

Oops, I’m sorry


#10

I didn’t make that very clear. You have the problem when you run as root not if you aren’t root. The npm people don’t want things installed via root.