javascript - 无法在 WSL 中运行 Electron Quick Start

标签 javascript node.js electron

您好,我在 Windows 子系统 Linux 上运行 Ubuntu 16.04.3 LTS。我正在尝试运行本节此处列出的快速入门第一个应用程序 https://electronjs.org/docs/tutorial/first-app但是,无论我是克隆存储库、自己编写还是删除并重新安装 Electron 模块,我都会不断收到相同的错误。

> electron .

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! first-electron@1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the first-electron@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

作为引用,我正在运行 Node :9.11.1 NPM:5.8.0

最佳答案

Electron 需要打开一个 chrome 浏览器窗口。因此,当您使用安装在 WSL 中的 node.js 从 WSL 运行它时,我猜它会尝试启动适用于 Ubuntu 的 Chromium 浏览器,这不会开箱即用,因为:

Microsoft doesn't support graphical programs on WSL. Bash on WSL is intended for running command-line programs that developers might need, but it's possible to run graphical Linux desktop programs on Windows using the Bash shell. To be more precise, you'll be able to display graphical programs running in WSL on a Windows 10 desktop by using an X server which runs on Windows 10.

https://virtualizationreview.com/articles/2017/02/08/graphical-programs-on-windows-subsystem-on-linux.aspx

关于javascript - 无法在 WSL 中运行 Electron Quick Start,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49936910/

相关文章:

dojo - 如何在 Electron 应用程序中使用 Dojo Toolkit?

javascript - 如何使用 Javascript 而不是 Jquery 将图像源设置为 div/img 背景图像?

javascript - 在 Google Chrome 中,在 body onload 上写入 DOM 不起作用

node.js - 验证失败时如何重新填充我的登录表单

javascript - 如何在 Electron renderer.js 文件中使用 Node.js 解析 JSON?

reactjs - 如何通过 react 制作的 Electron 应用程序制作MSI文件

JavaScript 移动延迟和多次击键

javascript - 升级到 Ionic RC4 后运行应用程序时出错

javascript - 如何在 sequelize(V5) 中使用 IF() 条件

node.js - Angular 2 : concurrent is not recognized as internal or external command