• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 857
  • Last Modified:

Pausing node.js in Visual Studio to see the output

I've been trying out the node.js tools for Visual Studio (2012 version).

http://www.hanselman.com/blog/introducingnodejstoolsforvisualstudio.aspx

If I run something with listen then the node.exe screen of course stays open and I can see what is written to the console.

However if there isn't any listen code the window closes immediately the code is run and you can't see the output.

It is possible to set a breakpoint which allows the window to stay open but it would be nice to be able to just either redirect the output to another window which doesn't close immediately or keep the node.exe screen open until it is closed.

I've had a search for solutions but they all seem pretty awkward like running a "wait" batch file on the code - is there a simple way to do this?
0
purplesoup
Asked:
purplesoup
  • 6
  • 4
  • 2
6 Solutions
 
Alexandre SimõesManager / Technology SpecialistCommented:
I have no clue what's going on but when I read this question I couldn't help asking why on earth would someone want to use VS to develop NodeJS apps...

What's the benefit?

NodeJS debugger works good and most of the times the basic console.log is more than enough... so why complicate what's simple?
0
 
purplesoupAuthor Commented:
Oh - is there a better debugger? I'm just learning node.js, I've done the code school course and downloaded node.js to discover it was just a command line console, so had a look around for a decent debugger and came across the Visual Studio addition.

Since I already have VS installed it seemed easier to use that than download a whole new IDE - how do you get the node.js debugger?

The node.js I downloaded just has the command prompt.
0
 
purplesoupAuthor Commented:
I had a go with this

http://nodejs.org/api/debugger.html

it seemed like something from the ark - I'm assuming there is something else available somewhere?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Alexandre SimõesManager / Technology SpecialistCommented:
Well it's not the most user friendly thing but it works and is the supported tool from the "makers" which usually saves us time and white hair on the long run.

I'm a .net native guy but currently there's no "native" thing for me anymore :)
I'm using VS for C# code, Eclipse for JAVA and Sublime Text 3 for everything else (HTML, CSS and of course Javascript).

One main reason is that everything that is not Windows specific I use it not only in Windows environments but also in Linux. So being used to tools that work in both brings great advantages.
0
 
purplesoupAuthor Commented:
ok that makes sense - thanks - I'll put some points aside for the explanation.

Erm if anyone *does* know how to keep that node window open I'd appreciate it...
0
 
leakim971PluritechnicianCommented:
@AlexCode are you aware of this plugins :
http://techcrunch.com/2013/11/21/microsoft-launches-node-js-tools-for-visual-studio/

IMHO VS is a great editor and devtools and from the two latest version not only for .NET development.
0
 
purplesoupAuthor Commented:
leakim971 - yes I'm pretty sure that's the plug in I'm asking about. How do I keep the console window open when running code?
0
 
purplesoupAuthor Commented:
AlexCode - I've had a go with Sublime Text - how do I get the code to run (from within the editor, obviously)?
0
 
Alexandre SimõesManager / Technology SpecialistCommented:
@purplesoup: You don't! And that's one wonderful part of it :)

It doesn't try to do multiple things, it's "just" a text editor on steroids :)
If you want to run your app you use the Terminal or Command Line... Perfect!! :p

No magic, no issues...
0
 
Alexandre SimõesManager / Technology SpecialistCommented:
@leakim971: It's the same as this one: https://github.com/tjanczuk/iisnode

I don't want to sound like I have something against Microsoft... I don't.
I've been developing for and with any technology that it's been required until now and Microsoft have been part of the bigger part of it.
It's just that some things are just not meant to be :)
They just feel like a hack and you'll have trouble with them just because you're forcing a square peg in a round hole or if you want another saying, they will help solve the problems that you wouldn't have if you weren't using those tools in the first place :)

If I'm developing a NodeJS app, chances are that I won't be deploying it on a windows server. A lot of reasons can be brought but price and performance are two big ones.

Also I don't really need an invented intellisense mechanism for my javascript and I don't need an 100Mb app (before memory leaks) to write javascript, neither HTML or CSS.
It's a wonderful tool for typed languages but just useless for dynamic and markup languages.

Call me old fashioned but I won't be more productive because of that and most of the times it's just more smoke that gets in the way.
It's the same experience I have with ReSharper... tried it multiple times, even bough it once but at the end I had no productivity improvements... The only effect I had was a slower IDE with shiny lights all over :)

Another case is debugging javascript on VS.
It's so easy and clean to do it directly on the browser, why on earth would I start using it on VS? Typescript can be a reason but the debugging is still so unstable that decreases my productivity instead of improving it.

Just wanted to share this as it's just my experience from my real world cases.
I'm sure many people have a different opinion about all this! :p

Cheers!
0
 
leakim971PluritechnicianCommented:
@AlexCode

I don't say the way you go is not the right one
I say if someone want to do it with VS, why not?

And that's why I asked you if you know the VS node plugin first because without it, there's not interest, IMHO, to develop nodejs app with VS.
NodeJS is not a simple javascript file and VS is not only a text editor.

MS do some right steps, I think we need to don't stay on our old position saying MS stuff is only for MS business which is right or false, it's not the question I think.

Like you I use Eclipse for Java, Javascript for team work
But for quick work, "basic" editor like Sublime Text

@purplesoup

If a command program is terminated I don't see why it should let its window opened.
Are you sure you're NODEJS still run? Or are you talking about your application in the web browser?
0
 
purplesoupAuthor Commented:
ok then it doesn't seem like there is a way, I'll close the question.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now