【问题标题】:NodeJS / NPM - Remote package bugNodeJS / NPM - 远程包错误
【发布时间】:2018-05-17 04:39:27
【问题描述】:

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

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

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

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

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

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

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

【问题讨论】:

标签: node.js npm dialog electron fs


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-20
    • 2018-09-16
    • 2014-09-11
    • 2015-02-24
    • 2023-04-01
    • 2013-04-27
    • 2014-10-03
    相关资源
    最近更新 更多