如何从Visual Studio代码运行我的电子项目
How can I run my electron project from Visual Studio Code
我是JavaScript新手。我想在Visual Studio代码中创建一个具有电子框架的应用程序。我正在处理debian。电子模块安装在本地,我可以从命令行执行我的应用程序。但不幸的是,我无法设置VS代码来运行它。我尝试了这个指南,但它对我没有帮助。我有以下launch.json:
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Launch main.js",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
// Workspace relative or absolute path to the program.
"program": "electron/main.js",
// Automatically stop program after launch.
"stopOnEntry": false,
// Command line arguments passed to the program.
"args": [],
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
"cwd": ".",
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
"runtimeExecutable": "node_modules/electron-prebuilt/dist/electron",
// Optional arguments passed to the runtime executable.
"runtimeArgs": [],
// Environment variables passed to the program.
"env": {
"NODE_ENV": "development"
},
// Use JavaScript source maps (if they exist).
"sourceMaps": false,
// If JavaScript source maps are enabled, the generated code is expected in this directory.
"outDir": null
},
{
"name": "Attach",
"type": "node",
// TCP/IP address. Default is "localhost".
"address": "localhost",
// Port to attach to.
"port": 5858,
"sourceMaps": false
}
]
}
如果我试图执行,但出现一个空白终端,VS代码说";OpenDebug进程已意外终止";。
更新:
同时,Visual Studio代码也有了很大的改进。下面是一个很好的描述,应该如何为电子设置VS代码:http://electron.rocks/debugging-electron-in-vs-code/
当你像这样运行electron时,你需要将一个参数传递到包含你的应用程序的目录。可能还有一些其他问题,但我认为你需要将程序设置为本地目录,而不是文件:
"program": ".",
然后,代码应该调用电子脚本并传递"."
作为第一个参数。电子也可能不支持调试选项,请尝试取消设置端口和地址属性。
相关文章:
- 为什么可以't我从hamsters.js内部运行我的方法
- 如何获取运行我的 Web 应用程序的用户的 Windows 登录用户名
- 无法让因果报应运行我的Angular2测试
- 可以't使用grunt-bower任务插件运行我的grunt-task
- 当其他函数调用Javascript时运行我的代码
- 如何停止回发运行我的 JavaScript 代码
- 为什么 Ghost.py 不加载/运行我的Javascript
- 升级的 Excel 和现在的 Visual Studio 不允许我运行我的外接程序项目
- 当我第二次运行我的应用程序时,结果没有显示
- Javascript - 我必须使用睡眠函数来运行我的函数
- 为什么我不能在谷歌浏览器中运行我的任何JavaScript
- 有没有办法通过 Greasemonkey 仅在命名帧(而不是所有帧)中运行我的 JS 代码
- 如何使用 shell 脚本文件运行我的节点脚本
- 使用 express.js 和 node.js 运行我的示例应用
- 为什么获胜't我的HTML按钮运行我的JavaScript函数
- 使用javascript,我如何发现打开并运行我的应用程序的软件
- 如何从Visual Studio代码运行我的电子项目
- plotly-js:如何在加载plot图像后才运行我的javascript
- 能够在localhost上运行我的主干js项目,不能在chrome浏览器中本地运行
- 我的HTML页面似乎没有运行我的JavaScript文件