Open xiaomizhou66 opened 5 years ago
windows 10
YOU SHOULD USE A PROXY
I met it on Mac , how to fix it?
The fix is very simple yet hard to find without understanding of how electron works. So here's the simple fix.
Just install vue-devtools as devDependency
npm i vue-devtools --save-dev or yarn add vue-devtools --dev
then edit the src/main/index.dev.js
const BrowserWindow = electron.BrowserWindow;
// Install `electron-debug` with `devtron`
require("electron-debug")({ showDevTools: true });
// Add `vue-devtools`
require("electron").app.on("ready", async () => {
// installExtension(VUEJS_DEVTOOLS)
// .then(() => {})
// .catch((err) => {
// console.log("Unable to install `vue-devtools`: \n", err);
// });
await new BrowserWindow.addDevToolsExtension(
"node_modules/vue-devtools/vender"
);
});
// Require `main` process to boot app
require("./index");```
You can now use Vue-Devtools on Electron Window
From following @primo19 suggestions:
npm i -D vue-devtools
index.dev.js
file to support the installed module:
# src/main/index.dev.ts
/**
electron-debug
& vue-devtools
. There shouldn't be any need to/ eslint-disable /
const BrowserWindow = require('electron').BrowserWindow;
// Install electron-debug
with devtron
require('electron-debug')({ showDevTools: true })
// Install vue-devtools
require('electron').app.on('ready', async () => {
// let installExtension = require('electron-devtools-installer')
// installExtension.default(installExtension.VUEJS_DEVTOOLS)
// .then(() => {})
// .catch(err => {
// console.log('Unable to install vue-devtools
: \n', err)
// })
await new BrowserWindow.addDevToolsExtension(
"node_modules/vue-devtools/vender"
);
})
// Require main
process to boot app
require('./index')
I'm running on Mac as well and was able to get the dev tools plugin working with the above file.
@crwgregory - this throws me the following new errors:
┏ Electron -------------------
(node:40039) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: BrowserWindow.addDevToolsExtensions is not a constructor
┗ ----------------------------
┏ Electron -------------------
(node:40039) [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.
┗ ----------------------------
@cdbrkfxrpt You're probably running a newer version of electron that doesn't support the BrowserWindow
https://stackoverflow.com/q/61894248/6214730
You'll probably have to downgrade or figure out how to migrate your code.
this is my config, if could help someone, electron 12
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
app.on('ready', async () => {
if (process.env.NODE_ENV !== 'production') {
try {
const vueDT = await installExtension(VUEJS_DEVTOOLS)
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
}
// debugger
}......