NodeJS / NPM - 远程包错误

NodeJS / NPM - Remote package bug

我正在构建一个需要 open/save 对话框的电子应用 window。

我正在在线遵循此指南:Standard Dialogs in Electron,它使用 remote 包。

远程包中的一个依赖文件出现语法错误,如下所示:

Unexpected token >: node_modules/remote/libs/remote.coffee:8

第 8 行是 module.exports = (opts = {}) ->,可能应该是 =>。如果我更改它,则会收到 Unexpected identifier 错误。这让我认为这里存在某种 ES6 支持问题。

我可以采取任何故障排除步骤来帮助缩小问题范围吗?

或者,对于打开 file/save 文件对话框 windows (mac) 的不同电子兼容包的建议。

此错误是由有关 require 语法的更新问题引起的。解决方法如下:

// use these lines instead to set up dialog instead of the remote package.
    const remote = require('electron').remote;
    const dialog = remote.dialog;

修复由 this Github comment

提供