-1
我在Windows 8上使用Electron on Visual Studio代碼。我是Electron的新手。
我使用的是electron-quick-start,它使用VS Code終端運行時,它在Visual Studio Code中工作。但是,當我嘗試調試代碼,我得到以下錯誤:Visual Studio代碼無法調試Electron
Debugger listening on [::]:46522
e:\Projects\BT\electron-quick-start\main.js:40
app.on('ready', createWindow)
^
TypeError: Cannot read property 'on' of undefined
at Object.<anonymous> (e:\Projects\BT\electron-quick-start\main.js:40:4)
at Module._compile (module.js:570:32)
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)
當調試達到main.js以下行出現的錯誤:
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
我正好用代碼electron-quick-start 。這意味着爲的package.json:
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"Electron",
"quick",
"start",
"tutorial",
"demo"
],
"author": "GitHub",
"license": "CC0-1.0",
"devDependencies": {
"electron": "~1.6.2"
}
}
我有什麼做的,可以在Visual Studio代碼調試代碼
正如我所說,它運行時,我終端運行:內部VSCode和外部。問題是當試圖用VSCode調試它時 –
你確定你在兩個終端上使用相同的命令嗎?你在用什麼終端? CMD?電源外殼? WSL? – ifconfig
是的。我在Windows 8中使用cmd時,在VS代碼外部調用它時,我在VS Code中使用集成終端。對於這兩個我使用命令「npm開始」,它在兩個工程。當我嘗試調試它時出現問題 –