【问题标题】:Failed to install node-libcurl for electron 5.0.10, both on mac and windows无法在 mac 和 windows 上为电子 5.0.10 安装 node-libcurl
【发布时间】:2020-01-02 11:14:13
【问题描述】:

我可以通过输入yarn add node-libcurl 将node-libcurl 添加到package.json/yarn.lock。但是到第二阶段electron-rebuild的时候,一直失败。我尝试了从10.11.0到13.5.0的许多带有nvm的节点版本,都失败了。我怀疑它是electron-rebuild problem,但不确定。如何使它与电子一起工作。有大佬能指点一下吗?

【问题讨论】:

    标签: electron node-libcurl


    【解决方案1】:

    这是因为 yarn add node-libcurl 正在为您正在使用的 Node.js 版本而不是 Electron 安装预构建的二进制文件。

    要将node-libcurl 与电子一起使用,yarn 命令需要一些额外的环境变量,这是您应该运行的命令:

    npm_config_build_from_source=true \
    npm_config_runtime=electron \
    npm_config_target=$(yarn --silent electron --version) \
    npm_config_disturl=https://atom.io/download/atom-shell \
    yarn add node-libcurl
    

    【讨论】:

    • npm_config_runtime=electron npm_config_target=5.0.10 npm_config_disturl=https://atom.io/download/atom-shell yarn add node-libcurl,我想使用预构建二进制文件并尝试了几次,但没有成功。我还尝试使用npm_config_build_from_source=true 从源代码构建,它也没有工作。
    • 我用一些详细的日志为此打开了一个问题。请检查一下。 github.com/JCMais/node-libcurl/issues/206
    • 能否在 repo 中添加一个电子演示?我在mac上使用从源代码构建电子的指导,它安装成功,但是从我的项目导入时,它编译失败。 @JCM
    猜你喜欢
    • 2018-08-12
    • 2017-11-07
    • 1970-01-01
    • 2021-10-29
    • 2018-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-08
    相关资源
    最近更新 更多