我试图将电子安装到我的项目中,但是它给出了一个错误。我也尝试用不安全的烫发来做这件事,但仍然给出同样的错误。
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
答案 0 :(得分:3)
请你试试(删除node_modules后)
sudo npm install electron --save-dev --save-exact --unsafe-perm=true --allow-root
我遇到了同样的错误,这对我有用。
答案 1 :(得分:0)
根据this GitHub issue,可以通过以下行动之一解决它:
node_modules
文件夹并再次运行npm install
答案 2 :(得分:0)
Electron 的安装后脚本正在从非 npm 域(可能是 github.com)下载二进制文件,可能没有为其配置代理。