NodeJS输出未在Visual Studio 2017中显示

时间:2018-10-01 21:54:58

标签: node.js visual-studio-2017

我试图在Visual Studio 2017(15.8.4)中开始使用NodeJS(8.12.0)。我的理解是,Node的输出应该出现在Visual Studio 2017的Output窗口(https://stackoverflow.com/a/49589521)中,但事实并非如此。我还认为,在发生错误/异常的情况下,Node的弹出控制台应保持打开状态,直到您将其关闭(http://www.intstrings.com/ramivemula/articles/jumpstart-35-prevent-visual-studio-node-js-console-closing-immediately-after-execution/),但这似乎并非如此:如果我运行异常代码,控制台会弹出并立即关闭。

代码没有错误,我可以强制控制台保持打开状态,例如:

var employees = [{
  "name": "Wendeline",
  "IsManager": "TRUE",
  "children": [{
    "name": "Goraud",
    "IsManager": "TRUE",
    "EmployeeNumber": 706997,
    "children": [{
      "name": "Mersey",
      "IsManager": "FALSE",
      "EmployeeNumber": 102752,
      "children": []
    }, {
      "name": "Elli",
      "IsManager": "FALSE",
      "EmployeeNumber": 742047,
      "children": [{
        "name": "Hans",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }]
    }, {
      "name": "Bald",
      "IsManager": "FALSE",
      "EmployeeNumber": 741064,
      "children": []
    }, {
      "name": "Truda",
      "IsManager": "FALSE",
      "EmployeeNumber": 739162,
      "children": []
    }, {
      "name": "Matty",
      "IsManager": "FALSE",
      "EmployeeNumber": 717067,
      "children": []
    }, {
      "name": "Ola",
      "IsManager": "TRUE",
      "EmployeeNumber": 713122,
      "children": [{
        "name": "Frankie",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Quint",
        "IsManager": "FALSE",
        "EmployeeNumber": 705616,
        "children": []
      }, {
        "name": "Georgi",
        "IsManager": "FALSE",
        "EmployeeNumber": 733001,
        "children": []
      }, {
        "name": "Danie",
        "IsManager": "FALSE",
        "EmployeeNumber": 742962,
        "children": []
      }, {
        "name": "Judon",
        "IsManager": "FALSE",
        "EmployeeNumber": 750620,
        "children": []
      }, {
        "name": "Nellie",
        "IsManager": "FALSE",
        "EmployeeNumber": 101490,
        "children": []
      }, {
        "name": "Marji",
        "IsManager": "FALSE",
        "EmployeeNumber": 705660,
        "children": []
      }, {
        "name": "Adelaida",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Bing",
        "IsManager": "FALSE",
        "EmployeeNumber": 745205,
        "children": []
      }, {
        "name": "Odilia",
        "IsManager": "FALSE",
        "EmployeeNumber": 718622,
        "children": []
      }]
    }, {
      "name": "Bernardina",
      "IsManager": "FALSE",
      "EmployeeNumber": 726710,
      "children": []
    }, {
      "name": "Myca",
      "IsManager": "FALSE",
      "EmployeeNumber": 726163,
      "children": []
    }, {
      "name": "Husain",
      "IsManager": "FALSE",
      "EmployeeNumber": 728267,
      "children": []
    }, {
      "name": "Cristie",
      "IsManager": "FALSE",
      "EmployeeNumber": 750267,
      "children": []
    }, {
      "name": "Nikolai",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "James",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Ashbey",
      "IsManager": "FALSE",
      "EmployeeNumber": 744719,
      "children": []
    }, {
      "name": "Flss",
      "IsManager": "FALSE",
      "EmployeeNumber": 746709,
      "children": []
    }, {
      "name": "Felisha",
      "IsManager": "FALSE",
      "EmployeeNumber": 739945,
      "children": [{
        "name": "Zelig",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Jakob",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }]
    }]
  }, {
    "name": "Cointon",
    "IsManager": "FALSE",
    "EmployeeNumber": "TBD",
    "children": []
  }, {
    "name": "Jo",
    "IsManager": "TRUE",
    "EmployeeNumber": 716884,
    "children": [{
      "name": "Sylvia",
      "IsManager": "FALSE",
      "EmployeeNumber": 744160,
      "children": []
    }, {
      "name": "Vicki",
      "IsManager": "FALSE",
      "EmployeeNumber": 735637,
      "children": []
    }, {
      "name": "Blanche",
      "IsManager": "FALSE",
      "EmployeeNumber": 729407,
      "children": []
    }, {
      "name": "Mirabelle",
      "IsManager": "FALSE",
      "EmployeeNumber": 731551,
      "children": []
    }, {
      "name": "Floria",
      "IsManager": "FALSE",
      "EmployeeNumber": 727255,
      "children": []
    }, {
      "name": "Flossie",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Anny",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Hyatt",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Juli",
      "IsManager": "FALSE",
      "EmployeeNumber": 740132,
      "children": []
    }, {
      "name": "Isacco",
      "IsManager": "FALSE",
      "EmployeeNumber": 742246,
      "children": []
    }, {
      "name": "Fleurette",
      "IsManager": "FALSE",
      "EmployeeNumber": 742205,
      "children": []
    }, {
      "name": "Dicky",
      "IsManager": "FALSE",
      "EmployeeNumber": 742736,
      "children": []
    }, {
      "name": "Wini",
      "IsManager": "FALSE",
      "EmployeeNumber": 741836,
      "children": []
    }, {
      "name": "Elden",
      "IsManager": "FALSE",
      "EmployeeNumber": 743234,
      "children": []
    }, {
      "name": "Marjie",
      "IsManager": "FALSE",
      "EmployeeNumber": 740196,
      "children": []
    }, {
      "name": "Vanna",
      "IsManager": "FALSE",
      "EmployeeNumber": 738053,
      "children": []
    }, {
      "name": "Emilio",
      "IsManager": "FALSE",
      "EmployeeNumber": 751901,
      "children": []
    }, {
      "name": "Enrique",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Lilas",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Elita",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Hyacintha",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Markus",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Calhoun",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Melisande",
      "IsManager": "FALSE",
      "EmployeeNumber": 748847,
      "children": []
    }, {
      "name": "Haroun",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Niles",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Adorne",
      "IsManager": "FALSE",
      "EmployeeNumber": 724804,
      "children": []
    }, {
      "name": "Dianne",
      "IsManager": "FALSE",
      "EmployeeNumber": 724863,
      "children": []
    }, {
      "name": "Faye",
      "IsManager": "FALSE",
      "EmployeeNumber": 732329,
      "children": []
    }, {
      "name": "Tabina",
      "IsManager": "FALSE",
      "EmployeeNumber": 724910,
      "children": []
    }]
  }, {
    "name": "Spike",
    "IsManager": "FALSE",
    "EmployeeNumber": 732941,
    "children": [{
      "name": "Reta",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Cirillo",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }]
  }, {
    "name": "Berty",
    "IsManager": "TRUE",
    "EmployeeNumber": 726527,
    "children": [{
      "name": "Gerrie",
      "IsManager": "TRUE",
      "EmployeeNumber": 727939,
      "children": [{
        "name": "Kelci",
        "IsManager": "FALSE",
        "EmployeeNumber": 739483,
        "children": []
      }, {
        "name": "Alexandros",
        "IsManager": "FALSE",
        "EmployeeNumber": 723369,
        "children": []
      }, {
        "name": "Loreen",
        "IsManager": "FALSE",
        "EmployeeNumber": 746432,
        "children": []
      }, {
        "name": "Cortie",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Keven",
        "IsManager": "FALSE",
        "EmployeeNumber": 723060,
        "children": []
      }, {
        "name": "Shanie",
        "IsManager": "FALSE",
        "EmployeeNumber": 707562,
        "children": []
      }, {
        "name": "Hatti",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Tammi",
        "IsManager": "FALSE",
        "EmployeeNumber": 717763,
        "children": []
      }, {
        "name": "Blondell",
        "IsManager": "FALSE",
        "EmployeeNumber": 731167,
        "children": []
      }]
    }, {
      "name": "Bellina",
      "IsManager": "FALSE",
      "EmployeeNumber": 731162,
      "children": []
    }, {
      "name": "Constancia",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }, {
      "name": "Dieter",
      "IsManager": "FALSE",
      "EmployeeNumber": 725942,
      "children": []
    }, {
      "name": "Illa",
      "IsManager": "FALSE",
      "EmployeeNumber": 733953,
      "children": [{
        "name": "Roley",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Talbot",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }]
    }, {
      "name": "Theodora",
      "IsManager": "TRUE",
      "EmployeeNumber": 721734,
      "children": [{
        "name": "Ebeneser",
        "IsManager": "FALSE",
        "EmployeeNumber": 741729,
        "children": []
      }, {
        "name": "Allie",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Benita",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Elmira",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Dene",
        "IsManager": "FALSE",
        "EmployeeNumber": 739572,
        "children": []
      }, {
        "name": "Hamil",
        "IsManager": "FALSE",
        "EmployeeNumber": 731393,
        "children": []
      }, {
        "name": "Fitzgerald",
        "IsManager": "FALSE",
        "EmployeeNumber": 710334,
        "children": [{
          "name": "Leon",
          "IsManager": "FALSE",
          "EmployeeNumber": "TBD",
          "children": []
        }]
      }, {
        "name": "Mignon",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Constantina",
        "IsManager": "FALSE",
        "EmployeeNumber": 744831,
        "children": []
      }, {
        "name": "Alysa",
        "IsManager": "FALSE",
        "EmployeeNumber": 736292,
        "children": []
      }]
    }]
  }, {
    "name": "Garrik",
    "IsManager": "FALSE",
    "EmployeeNumber": "TBD",
    "children": []
  }, {
    "name": "Onofredo",
    "IsManager": "FALSE",
    "EmployeeNumber": "TBD",
    "children": []
  }, {
    "name": "Josefa",
    "IsManager": "FALSE",
    "EmployeeNumber": "TBD",
    "children": []
  }, {
    "name": "Nan",
    "IsManager": "FALSE",
    "EmployeeNumber": "TBD",
    "children": []
  }, {
    "name": "Birgit",
    "IsManager": "FALSE",
    "EmployeeNumber": "TBD",
    "children": []
  }, {
    "name": "Ashlan",
    "IsManager": "FALSE",
    "EmployeeNumber": "TBD",
    "children": []
  }, {
    "name": "Rod",
    "IsManager": "TRUE",
    "EmployeeNumber": 726043,
    "children": [{
      "name": "Lorie",
      "IsManager": "TRUE",
      "EmployeeNumber": 711520,
      "children": [{
        "name": "Norris",
        "IsManager": "FALSE",
        "EmployeeNumber": 736426,
        "children": []
      }, {
        "name": "Josefa",
        "IsManager": "FALSE",
        "EmployeeNumber": 728365,
        "children": []
      }, {
        "name": "Carma",
        "IsManager": "FALSE",
        "EmployeeNumber": 751153,
        "children": []
      }, {
        "name": "Rozelle",
        "IsManager": "FALSE",
        "EmployeeNumber": 738418,
        "children": []
      }, {
        "name": "Tine",
        "IsManager": "FALSE",
        "EmployeeNumber": 721367,
        "children": []
      }, {
        "name": "Ransom",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Hildagarde",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Grant",
        "IsManager": "FALSE",
        "EmployeeNumber": 712948,
        "children": []
      }]
    }, {
      "name": "Karilynn",
      "IsManager": "FALSE",
      "EmployeeNumber": 102152,
      "children": []
    }, {
      "name": "Tine",
      "IsManager": "FALSE",
      "EmployeeNumber": 717285,
      "children": []
    }, {
      "name": "Lenna",
      "IsManager": "FALSE",
      "EmployeeNumber": 707659,
      "children": []
    }, {
      "name": "Fanni",
      "IsManager": "TRUE",
      "EmployeeNumber": 102936,
      "children": [{
        "name": "Nani",
        "IsManager": "FALSE",
        "EmployeeNumber": 726746,
        "children": []
      }, {
        "name": "Jethro",
        "IsManager": "FALSE",
        "EmployeeNumber": 744442,
        "children": []
      }, {
        "name": "Olenka",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Morena",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Susana",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Hammad",
        "IsManager": "FALSE",
        "EmployeeNumber": "TBD",
        "children": []
      }, {
        "name": "Erwin",
        "IsManager": "FALSE",
        "EmployeeNumber": 711550,
        "children": []
      }]
    }, {
      "name": "Petr",
      "IsManager": "FALSE",
      "EmployeeNumber": "TBD",
      "children": []
    }]
  }]
}]

...但是显然,这只是一种解决方法,如果实际上有错误,它仍然不起作用。

我在那个Node上应该输出到VS的输出窗口是错误的,并且/或者保持打开状态以便允许我阅读潜在的错误吗?我已经在Google和Google上进行过搜索,但似乎无法弄清楚为什么这两种情况在我的案例中都没有发生,以及如何解决它们。任何想法将不胜感激。

1 个答案:

答案 0 :(得分:1)

选中Visual Studio 2017 Node.js Exceptions not working

特别是“ Debug-> Windows-> Exceptions->启用JavaScript(Node.js 8+)”达到目的。