Solved

Pausing node.js in Visual Studio to see the output

Posted on 2013-12-05
12
760 Views
Last Modified: 2013-12-06
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
Comment
Question by:purplesoup
  • 6
  • 4
  • 2
12 Comments
 
LVL 30

Assisted Solution

by:Alexandre Simões
Alexandre Simões earned 334 total points
ID: 39697861
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
 

Author Comment

by:purplesoup
ID: 39697870
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
 

Author Comment

by:purplesoup
ID: 39697881
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
 
LVL 30

Assisted Solution

by:Alexandre Simões
Alexandre Simões earned 334 total points
ID: 39697905
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
 

Author Comment

by:purplesoup
ID: 39697953
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
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 166 total points
ID: 39698370
@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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:purplesoup
ID: 39698484
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
 

Author Comment

by:purplesoup
ID: 39698486
AlexCode - I've had a go with Sublime Text - how do I get the code to run (from within the editor, obviously)?
0
 
LVL 30

Assisted Solution

by:Alexandre Simões
Alexandre Simões earned 334 total points
ID: 39698534
@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
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 334 total points
ID: 39698571
@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
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 166 total points
ID: 39698655
@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
 

Author Comment

by:purplesoup
ID: 39700579
ok then it doesn't seem like there is a way, I'll close the question.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now