2017-06-15 3 views
0

StartkonfigurationDebug in Visual Studio Code funktionieren nicht

{ 
    // Use IntelliSense to learn about possible Node.js debug attributes. 
    // Hover to view descriptions of existing attributes. 
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 
    "version": "0.2.0", 
    "configurations": [ 
     { 
      "type": "node", 
      "request": "attach", 
      "name": "Attach", 
      "port": 5858 
     }, 
     { 
      "type": "node", 
      "request": "launch", 
      "name": "Launch Program", 
      "program": "${workspaceRoot}/src/app.js", 
      "cwd": "${workspaceRoot}" 
     } 
    ] 
} 

ich die folgende Störung erhalten beim Debuggen meines Code in Visual Studio Code reagieren. Eigentlich habe ich das Projekt mit node + react erstellt und verwende visual studio als IDE und möchte meinen Code debuggen. Ich habe viel versucht, bin aber nicht in der Lage, meinen Code zu debuggen.

Debugging with legacy protocol because Node.js v6.10.2 was detected.Program path uses differently cased character as file on disk; this might result in breakpoints not being hit. 
node --debug-brk=21730 --nolazy src\app.js 
    Debugger listening on [::]:21730 
    e:\reactjs\reactFacebook\my-app\src\app.js:1 
    (function (exports, require, module, __filename, __dirname) { import React, { Component } from 'react'; 
                    ^^^^^^ 
    SyntaxError: Unexpected token import 
     at createScript (vm.js:56:10) 
     at Object.runInThisContext (vm.js:97:10) 
     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:380:14) 
     at tryOnTimeout (timers.js:244:5) 
+0

Wahrscheinlich im Zusammenhang mit [VS-Code-Problem # 24764] (https://github.com/Microsoft/vscode/issues/24764). Wie in der Ausgabe erwähnt, versuche "' protocol ":" inspector "' in deiner 'launch.json' hinzuzufügen. – putu

Antwort

0

ich hatte das gleiche Problem, dreht sich der Schlüssel in der Konsole war out: Debuggen mit Legacy-Protokoll, da Node.js v6.10.2 wurde nachgewiesen.

ich beschlossen es mit den folgenden Schritten:

  • Shutdown VS-Code
  • Uninstall Knoten
  • Knoten installieren v5 mit NVM
  • node_modules Ordner in Projekt löschen
  • wieder öffnen VS-Code
  • Lauf npm install

Platzieren Sie einen Haltepunkt und versuchen Sie es erneut.

Verwandte Themen