npm安裝Electron解決方案
Electron使用npm安裝時栅受,因為是國外的鏡像源,所以速度會非常慢。而使用cnpm如下命令進行安裝時,又會出現(xiàn)安裝失敗的問題:
npm install electron -g
1
execute post install 1 scripts...
[1/1] scripts.postinstall electron@6.0.3 run "node install.js", root: "C:\\Users\\94012\\AppData\\Roaming\\npm\\node_modules\\electron"
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.<anonymous>
[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
......
從報錯原因上浇垦,發(fā)現(xiàn)是找不到這個版本的electron,然后返回404了荣挨。
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
所以找到原因就好說了男韧,那就指定之前的版本安裝即可,如: