我正在使用 vue2-electron builder 开发一个项目。但是当我运行这段代码时,它没有显示。
错误是;
(node:10500) ExtensionLoadWarning: Warnings loading extension at C:\Users\Dell\AppData\Roaming\project\extensions\nhdogjmejiglipccpnnnanhblpccpnnnanhbledajbpd:
Unrecognized manifest key 'browser_action'.
Unrecognized manifest key 'update_url'.
Permission 'contextMenus' is unknown or URL pattern is malformed.
Cannot load extension with file or directory name _metadata. Filenames starting with "_" are reserved for use by the system.
(Use `electron --trace-warnings ...` to show where the warning was created)
我的background.js是;
'use strict'
import { app, protocol, BrowserWindow } from 'electron'
const path = require('path')
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
const isDevelopment = process.env.NODE_ENV !== 'production'
protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { secure: true, standard: true } }
])
async function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
icon: path.join(__dirname, '../build/icons/logo.png'),
webPreferences: {
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
}
})
if (process.env.WEBPACK_DEV_SERVER_URL) {
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app')
win.loadURL('app://./index.html')
}
}
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
event.preventDefault();
callback(true);
})
app.on('ready', async () => {
if (isDevelopment && !process.env.IS_TEST) {
try {
await installExtension("nhdogjmejiglipccpnnnanhbledajbpd");
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
}
}
createWindow()
})
// Exit cleanly on request from parent process in development mode.
if (isDevelopment) {
if (process.platform === 'win32') {
process.on('message', (data) => {
if (data === 'graceful-exit') {
app.quit()
}
})
} else {
process.on('SIGTERM', () => {
app.quit()
})
}
}
我该如何修复。?
我从https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/776搜索它 还有另一个链接在此处输入链接描述
你能帮我吗?
这只是与扩展程序的
manifest.json
文件相关的警告,不应阻止其工作。
顺便说一下,您使用的扩展 ID
nhdogjmejiglipccpnnnanhbledajbpd
可能不适用于 Vue2,因为它适用于当前维护的版本。
您可以考虑使用 Vue JS 的遗留扩展 ID
iaajmlceplecbljialhhkmedjlpdblhp
。