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