NodeJS / NPM - 远程软件包错误

时间:2017-12-03 17:25:56

标签: node.js npm dialog electron fs

我正在构建一个需要打开/保存对话窗口的电子应用程序。

我在线关注本指南:Standard Dialogs in Electron使用remote包。

我收到远程包中的一个依赖项文件的语法错误,如下所示:

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

第8行是module.exports = (opts = {}) ->,可能应该是=>。如果我改变了,我会收到Unexpected identifier错误。这让我觉得这里有一些ES6支持问题。

我可以采取任何疑难解答步骤来帮助缩小问题范围吗?

或者,建议使用不同的电子兼容包打开文件/保存文件对话框窗口(mac)。

1 个答案:

答案 0 :(得分:0)

此错误是由有关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

的礼貌
相关问题