安装ELectron失败解决方案

2019/11/22 20:39
阅读数 457

<h3>npm安装Electron解决方案</h3> <p>Electron使用npm安装时,因为是国外的镜像源,所以速度会非常慢。而使用cnpm如下命令进行安装时,又会出现安装失败的问题:</p> <pre><code class='language-shell' lang='shell'>npm install electron -g execute post install 1 scripts... [1/1] scripts.postinstall electron@6.0.3 run &quot;node install.js&quot;, root: &quot;C:\\Users\\94012\\AppData\\Roaming\\npm\\node_modules\\electron&quot; Downloading tmp-1428-0-electron-v6.0.3-win32-x64.zip Error: GET https://cdn.npm.taobao.org/dist/electron/6.0.3/electron-v6.0.3-win32-x64.zip returned 404 C:\Users\94012\AppData\Roaming\npm\node_modules\electron\install.js:49 throw err ^ ...... Error: Failed to find Electron v6.0.3 for win32-x64 at https://cdn.npm.taobao.org/dist/electron/6.0.3/electron-v6.0.3-win32-x64.zip at Request.&lt;anonymous&gt;

[npminstall:runscript:error] electron@6.0.3 scripts.postinstall run "node install.js" error: RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c node install.js" error, exit code 1 Install fail! RunScriptError: post install error, please remove node_modules before retry! Run "C:\Windows\system32\cmd.exe /d /s /c node install.js" error, exit code 1 RunScriptError: post install error, please remove node_modules before retry! Run "C:\Windows\system32\cmd.exe /d /s /c node install.js" error, exit code 1 at ChildProcess.proc.on.code ...... </code></pre>

<p>从报错原因上,发现是找不到这个版本的electron,然后返回404了。</p> <pre><code class='language-shell' lang='shell'>Downloading tmp-1428-0-electron-v6.0.3-win32-x64.zip Error: GET https://cdn.npm.taobao.org/dist/electron/6.0.3/electron-v6.0.3-win32-x64.zip returned 404 </code></pre> <p>所以找到原因就好说了,那就指定之前的版本安装即可,如:</p> <pre><code class='language-shell' lang='shell'>cnpm install electron@^6.0.1 -g </code></pre> <p>&nbsp;</p>

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部