I have installed Node.js in Windows 8 PC and installed the Node.js plugin for Visual Studio 2012. I executed a basic program from Visual St
One Easy way to track and work may be,
"Right click on project" -> Open Command Promp Here.
.
and execute the file with node <filename>
or project with npm start
Hope this helps..!
None of these worked for me, so I just set a breakpoint at the last line of code. An awkward solution but does the trick.
Instead of directly executing node app.js
from Visual Studio, you could instead call a batch file:
wait.bat app.js
Which inside of wait.bat
it simply:
node %1
pause press [enter]
or, you could do this on one line, or wrap it in a module or a function:
require('readline')
.createInterface(process.stdin, process.stdout)
.question("Press [Enter] to exit...", function(){
process.exit();
});
It's using an currently marked as "unstable" module of Node to read line input from stdin
. It ignores the input though and then closes the process using the exit
function.
Applies to all visual studio versions.
Option 1
console.log('Hello world');
setTimeout(function () {
process.exit();
}, 5000);
From the Debug menu in Visual Studio choose "Options". After this choose "NodeJS Tools" and tick the checkbox "Wait for input when process exits normally".
The previous answer:
From the Debug menu in Visual Studio choose "Options". After this choose "NodeJS Tools" and tick the checkbox "Wait for input when process exits normally".
... Seems to work if you run without debugging.
Debug>Start Without Debugging Ctrl-F5