版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
最新版本可能存在问题。这种情况要去npm官网查看electron的版本记录选择一个不是最新的版本进行安装。:
这里我是:然后成功了
cnpm install -g [email protected]
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
^
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at getElectronPath (E:\electronjsTest\node_modules\[email protected]@electron\index.js:14:11)
at Object.<anonymous> (E:\electronjsTest\node_modules\[email protected]@electron\index.js:18:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (E:\electronjsTest\node_modules\[email protected]@electron\cli.js:3:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start 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\14140\AppData\Roaming\npm-cache\_logs\2019-10-23T07_43_39_353Z-debug.log
√ Installed 1 packages
√ Linked 54 latest versions
[1/1] scripts.postinstall electron@^7.0.0 run "node install.js", root: "E:\\electronjsTest\\node_modules\\[email protected]@electron"
(node:18144) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, lstat 'C:\Users\14140\AppData\Local\Temp\electron-download-u63FpX\electron-v7.0.0-win32-x64.zip'
(node:18144) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18144) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[1/1] scripts.postinstall electron@^7.0.0 finished in 3s
√ Run 1 scripts
Recently updated (since 2019-10-16): 2 packages (detail see file E:\electronjsTest\node_modules\.recently_updates.txt)
Today:
→ [email protected] › @types/node@^12.0.12(12.11.5) (05:00:56)
√ All packages installed (59 packages installed from npm registry, used 5s(network 2s), speed 82.07kB/s, json 55(136.4kB), tarball 0B)