【问题标题】:Failed at the electron@1.8.2 postinstall script在 electron@1.8.2 安装后脚本失败
【发布时间】:2018-07-21 12:54:32
【问题描述】:

我试图将电子安装到我的项目中,但它给出了错误。我也试过用 unsafe-perm 来做这个,但仍然报同样的错误。

npm install electron --save-dev --save-exact

> electron@1.8.2 postinstall E:\PrgLang\Electron\crypto-app\node_modules\electron
> node install.js

Downloading electron-v1.8.2-win32-x64.zip
[============================================>] 100.0% of 55.21 MB (1.51 MB/s)
E:\PrgLang\Electron\crypto-app\node_modules\electron\install.js:47
throw err
^

Error: Could not parse checksum file at line 1:
at new ChecksumParseError (E:\PrgLang\Electron\crypto-app\node_modules\sumchecker\build.js:71:127)
at E:\PrgLang\Electron\crypto-app\node_modules\sumchecker\build.js:130:20
at Array.forEach (<anonymous>)
at E:\PrgLang\Electron\crypto-app\node_modules\sumchecker\build.js:125:38
at new Promise (<anonymous>)
at ChecksumValidator.parseChecksumFile (E:\PrgLang\Electron\crypto-app\node_modules\sumchecker\build.js:121:14)
at <anonymous>
npm WARN crypto-app@1.0.0 No description
npm WARN crypto-app@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.8.2 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.8.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Harshit\AppData\Roaming\npm-cache\_logs\2018-02-11T03_33_52_399Z-debug.log

【问题讨论】:

    标签: npm electron


    【解决方案1】:

    你能试试吗(删除 node_modules 后)

    sudo npm install electron --save-dev --save-exact --unsafe-perm=true --allow-root

    我遇到了同样的错误,这对我有用。

    【讨论】:

    • 为我工作!!不错。
    • 我觉得--unsafe-perm=true应该够用了
    【解决方案2】:

    根据this GitHub issue,可以通过以下操作之一解决:

    • 删除node_modules 文件夹并再次运行npm install
    • 重命名用户主目录的 .electron 文件夹中的 SHASUM 文件

    【讨论】:

    • 是否在您的本地 .electron 文件夹中创建了新的 SHASUM 文件?
    • 祝你好运。我在 Linux 服务器上遇到了同样的问题。当然,一切都在我的本地 WAMP 服务器上运行良好......
    【解决方案3】:

    Electron 的安装后脚本正在从非 npm 域(可能是 github.com)下载二进制文件,可能未为其配置代理。

    【讨论】:

      猜你喜欢
      • 2017-03-29
      • 2017-08-02
      • 2015-02-11
      • 2020-01-25
      • 2018-11-06
      • 1970-01-01
      • 1970-01-01
      • 2019-05-17
      • 2021-09-07
      相关资源
      最近更新 更多