[英]Cannot find module {applicationPath}
I am trying to run an application in debug mode from Visual Studio code. 我试图从Visual Studio代码以调试模式运行应用程序。 When I click debug following error occurs:
当我单击调试时,会发生以下错误:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'C:\electron2\electron_app\--inspect-brk=15965'
at Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
at Function.Module._resolveFilename (C:\electron2\electron_app\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.Module._load (internal/modules/cjs/loader.js:528:25)
at Module.require (internal/modules/cjs/loader.js:658:17)
at init (C:\electron2\electron_app\node_modules\electron-compile\lib\config-parser.js:294:16)
at main (C:\electron2\electron_app\node_modules\electron-prebuilt-compile\lib\es6-init.js:58:29)
at Object.<anonymous> (C:\electron2\electron_app\node_modules\electron-prebuilt-compile\lib\es6-init.js:61:1)
at Object.<anonymous> (C:\electron2\electron_app\node_modules\electron-prebuilt-compile\lib\es6-init.js:63:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
My debug configuration looks like this 我的调试配置如下所示
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"args" : ["."]
}
]
}
Also one more error caught: 还捕获了另一个错误:
No such module: atom_browser_features
Never heard of such module before. 以前从未听说过这样的模块。
Used to work before, but all of sudden it stopped to work. 以前曾经工作过,但是突然间它停止工作了。 Anyone has a clue what the problem might be?
任何人都知道可能是什么问题吗?
You are likely having issues because --inspect-brk=15965
is being interpreted as the "main" script. 您可能会遇到问题,因为
--inspect-brk=15965
被解释为“主”脚本。
Assuming the command line is generated similar to noseratio's: 假设生成的命令行类似于noseratio的命令行:
C:/test/node_modules/.bin/electron.cmd --remote-debugging-port=9223 . --inspect-brk=47365
You can see that --inspect-brk
comes after the declared args, however, node arguments must be declared prior to the "main" script. 您可以看到
--inspect-brk
在声明的args之后,但是,节点参数必须在“ main”脚本之前声明。 You can try upgrading to electron@3.0.8
to see if the issue resolves itself. 您可以尝试升级到
electron@3.0.8
来查看问题是否自行解决。 Alternatively, you could attempt to be more explicit with the entry point like they have done in the electron-quick-start
project. 另外,您也可以像在
electron-quick-start
项目中所做的那样,尝试对入口点更加明确。
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"program": "${workspaceRoot}/main.js",
"protocol": "inspector"
}
代替“ $ {workspaceRoot} /node_modules/.bin/electron”,在运行时可执行文件和windows:{runtimeexecutable}中使用“ {workspaceRoot} \\\\ node_modules \\ .bin \\\\ electron”,因为您正在使用Windows。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.