Closed xb284524239 closed 3 years ago
My guess is that the cached electron download got corrupted. Try deleting your ~/Library/Caches/electron/
folder and node_modules
, then reinstall deps.
You can fix this by running the following command:
node node_modules/electron/install.js
That is supposed to get fixed when you run npm install but sometimes it doesn't for some reason.
Describe the bug When i typed command in the terminal:npm run electron:serve then : Error: Electron failed to install correctly, please delete node_modules/electron and try installing again. I have deleted "node_modules/electron" and tried npm install & npm run electron:serve , it report the same error message again.
To Reproduce node version: 14.16.1 npm version: 7.14.0 vue-cli version: @vue/cli 4.5.13
Steps : 1、vue create helloworld 2、vue add electron-builder 3、npm installl 4、npm run electron:serve 5、report the error message like above
Environment (please complete the following information):
custom config for vcp-electron-builder: I don't set any custom config after create the project.
terminal output from running
vue info
: System: OS: macOS 10.15.7 CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz Binaries: Node: 14.16.1 - /usr/local/bin/node Yarn: Not Found npm: 7.14.0 - /usr/local/bin/npm Browsers: Chrome: 90.0.4430.212 Edge: Not Found Firefox: Not Found Safari: 14.0 npmPackages: @vue/babel-helper-vue-jsx-merge-props: 1.2.1 @vue/babel-helper-vue-transform-on: 1.0.2 @vue/babel-plugin-jsx: 1.0.6 @vue/babel-plugin-transform-vue-jsx: 1.2.1 @vue/babel-preset-app: 4.5.13 @vue/babel-preset-jsx: 1.2.4 @vue/babel-sugar-composition-api-inject-h: 1.2.1 @vue/babel-sugar-composition-api-render-instance: 1.2.4 @vue/babel-sugar-functional-vue: 1.2.2 @vue/babel-sugar-inject-h: 1.2.2 @vue/babel-sugar-v-model: 1.2.3 @vue/babel-sugar-v-on: 1.2.3 @vue/cli-overlay: 4.5.13 @vue/cli-plugin-babel: ~4.5.0 => 4.5.13 @vue/cli-plugin-eslint: ~4.5.0 => 4.5.13 @vue/cli-plugin-router: ~4.5.0 => 4.5.13 @vue/cli-plugin-vuex: ~4.5.0 => 4.5.13 @vue/cli-service: ~4.5.0 => 4.5.13 @vue/cli-shared-utils: 4.5.13 @vue/compiler-core: 3.0.11 @vue/compiler-dom: 3.0.11 @vue/compiler-sfc: ^3.0.0 => 3.0.11 @vue/compiler-ssr: 3.0.11 @vue/component-compiler-utils: 3.2.0 @vue/devtools-api: 6.0.0-beta.11 @vue/eslint-config-prettier: ^6.0.0 => 6.0.0 @vue/preload-webpack-plugin: 1.1.2 @vue/reactivity: 3.0.11 @vue/runtime-core: 3.0.11 @vue/runtime-dom: 3.0.11 @vue/shared: 3.0.11 @vue/web-component-wrapper: 1.3.0 eslint-plugin-vue: ^7.0.0 => 7.9.0 vue: ^3.0.0 => 3.0.11 vue-cli-plugin-electron-builder: ~2.0.0 => 2.0.0 vue-eslint-parser: 7.6.0 vue-hot-reload-api: 2.3.4 vue-loader: 15.9.7 (16.2.0) vue-router: ^4.0.0-0 => 4.0.8 vue-style-loader: 4.1.3 vue-template-es2015-compiler: 1.9.1 vuex: ^4.0.0-0 => 4.0.1 npmGlobalPackages: @vue/cli: 4.5.13Terminal report:
MacBook-Pro:WorkSpace_VSCode paul$ vue create electron4
Vue CLI v4.5.13 ? Please pick a preset: preference-vue3 ([Vue 3] dart-sass, babel, router, vuex, eslint)
Vue CLI v4.5.13 ✨ Creating project in /Users/paul/Documents/WorkSpace_VSCode/electron4. 🗃 Initializing git repository... ⚙️ Installing CLI plugins. This might take a while...
added 1275 packages in 28s 🚀 Invoking generators... 📦 Installing additional dependencies...
added 92 packages, and changed 1 package in 5s ⚓ Running completion hooks...
📄 Generating README.md...
🎉 Successfully created project electron4. 👉 Get started with the following commands:
$ cd electron4 $ npm run serve
MacBook-Pro:WorkSpace_VSCode paul$ cd electron4 MacBook-Pro:electron4 paul$ vue add electron-builder
📦 Installing vue-cli-plugin-electron-builder...
added 276 packages, and changed 1 package in 9s ✔ Successfully installed plugin: vue-cli-plugin-electron-builder
? Choose Electron Version ^12.0.0
🚀 Invoking generator for vue-cli-plugin-electron-builder... 📦 Installing additional dependencies...
• electron-builder version=22.10.5
added 41 packages in 5s ⠋ Running completion hooks...
WARN It is detected that you are using Vue Router. It must function in hash mode to work in Electron. Learn more at https://goo.gl/GM1xZG . ⚓ Running completion hooks...
✔ Successfully invoked generator for plugin: vue-cli-plugin-electron-builder MacBook-Pro:electron4 paul$ npm run electron:serve
/Users/paul/Documents/WorkSpace_VSCode/electron4/node_modules/electron/index.js:14 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 (/Users/paul/Documents/WorkSpace_VSCode/electron4/node_modules/electron/index.js:14:11) at Object. (/Users/paul/Documents/WorkSpace_VSCode/electron4/node_modules/electron/index.js:18:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (/Users/paul/Documents/WorkSpace_VSCode/electron4/node_modules/vue-cli-plugin-electron-builder/lib/testWithSpectron.js:2:22)
at Module._compile (internal/modules/cjs/loader.js:1063:30)