简体   繁体   中英

debug node js through task runner explorer in Visual Studio 2017

I am using Visual Studio 2017 with npm task runner explorer. Through the task runner I am executing node scripts with the node command. How can I have Visual Studio debugging the invoked Javascript?

From the nodejstools Advanced-Debugging wiki :

It is also possible to attach to a locally running Node.exe process, if it was started with debugging enabled, using the '--debug' command line argument:

So if you are using your VS2017 task runner explorer to run npm tasks with the NPM Task runner extension you'll have to adjust your npm scripts task to something like this :

"scripts": {
    "test": "node --debug .\\cool-script.js"
  },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM