node.js - 无法在 Windows 10 中安装 Electron

标签 node.js electron

您好,我正在尝试使用以下命令在 Windows 系统中安装 Electron 。

- npm install -g electron
- npm install electron
- npm install electron --save-dev

对于所有这些命令,我​​收到以下错误。

C:\Users\abc\Desktop\final\new>electron@
'electron@' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\abc\Desktop\final\new>npm install electron

> electron@1.6.6 postinstall C:\Users\abc\Desktop\final\new\node_modules\electron
> node install.js

C:\Users\abc\Desktop\final\new\node_modules\electron\install.js:47
  throw err
  ^

Error: ENOENT: no such file or directory, lstat 'C:\Users\abc\Desktop\final\new\node_modules\electron\dist\resources'
npm WARN Alfa@1.0.0 No repository field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "electron"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! electron@1.6.6 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.6.6 postinstall script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs electron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls electron
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\abc\AppData\Roaming\npm-cache\_logs\2017-04-30T12_57_18_073Z-debug.log

C:\Users\abc\Desktop\final\new>

我也尝试更新 Node 和 npm,但仍然收到此错误。有人可以帮帮我吗 ? 。提前致谢。

最佳答案

最近我在 Ubuntu 16.04 上使用 Node.js v8 时遇到了这个问题。但是当我降级到 Node.js v6 时,它安装成功了。

关于node.js - 无法在 Windows 10 中安装 Electron,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43706749/

相关文章:

angular - 如何使用Angular 2自动执行 Electron 应用程序的工作流程

node.js - 指定 `env` 时,childProcess.spawn 失败

javascript - 无法在文件资源管理器中打开子目录? - Node .js

javascript - 使用嵌入文档列表和使用 ObjectId 列表之间有区别吗?

javascript - 如何在JS中向具有特定参数/值的子对象添加属性?

node.js - Electron-rebuild 构建错误版本的 node-sqlite3

reactjs - JSSIP如何在音频通话与视频通话之间切换

node.js - 如何使用 ssh 使用 nodegit 克隆 git 存储库

node.js - mongodb mongoose nodejsexpress4 为什么会自动在对象数组字段中插入_id?

javascript - 为什么我的数组在访问时是空的,但在观察时是满的?