为什么Windows 8中会立即关闭Node.js脚本控制台? [英] Why does the Node.js scripts console close instantly in Windows 8?

查看:78
本文介绍了为什么Windows 8中会立即关闭Node.js脚本控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎尝试了所有可以找到的脚本示例。每个样本都会瞬间打开终端。输入输入后,即使关闭。这是正常现象吗?

I've tried nearly every example for scripts I can find. Every sample opens the terminal for a split second. Even this closes as soon as input is entered. Is this normal?

    var rl = require('readline');

var prompts = rl.createInterface(process.stdin, process.stdout);

prompts.question("How many servings of fruits and vegetables do you eat each day? ", function  (servings) {
    var message = '';

    if (servings < 5) {
        message = "Since you're only eating " + servings + 
        " right now, you might want to start eating " + (5 - servings) + " more.";
    } else {
        message = "Excellent, your diet is on the right track!";
    }

    console.log(message);

  process.exit();
});


推荐答案

在工具/选项中有2个控制此选项的选项/Node.js工具/常规:

There are 2 options that control this in Tools/Options/Node.js Tools/General:

在进程异常存在时等待输入
在进程正常存在时等待输入

Wait for input when process exists abnormally Wait for input when process exists normally

来自 https://nodejstools.codeplex.com/discussions/565665

这篇关于为什么Windows 8中会立即关闭Node.js脚本控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆