相关疑难解决方法(0)

如何在Visual Studio代码中调试子Node.JS进程?

如何在VS Code中调试子Node.JS进程?
以下是我正在尝试调试的代码示例:

var spawn = require('child_process').spawn;
var scriptPath = './child-script.js';
var runner_ = spawn('node', [scriptPath]);
Run Code Online (Sandbox Code Playgroud)

debugging child-process node.js visual-studio-code

10
推荐指数
2
解决办法
5526
查看次数

如何在VSCode编辑器中调试NodeJS(ES6)代码?

我正在尝试从VSCode调试我在ES6中编写的nodejs应用程序.但它抛出以下错误:

node --debug-brk=18712 --nolazy index.js 
Debugger listening on [::]:18712
/Users/rsiva/Projects/Siva/ntask/ntask-api/index.js:1
(function (exports, require, module, __filename, __dirname) { import express from "express";
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Timeout.Module.runMain [as _onTimeout] (module.js:604:10)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
Run Code Online (Sandbox Code Playgroud)

我看过如何在VS Code中调试vue js应用程序?https://medium.com/@katopz/how-to-debug-es6-nodejs-with-vscode-8d00bd6c4f94#.yaevayjs3但这些解决方案无效.

我的package.json:

{
  "name": "ntask-api",
  "version": "1.0.0",
  "description": "Task list API",
  "main": "index.js",
  "scripts": {
    "start": …
Run Code Online (Sandbox Code Playgroud)

javascript babel node.js visual-studio-code

10
推荐指数
1
解决办法
7672
查看次数