MarshallOfSound / electron-devtools-installer

An easy way to ensure Chrome DevTools extensions into Electron
MIT License
1.11k stars 136 forks source link

Errors while installing extensions as shown in the README #236

Closed Kyanoxia closed 1 year ago

Kyanoxia commented 1 year ago

Let me preface this by saying I'm a beginner, so this might be an issue I am causing without knowing it, but as far as I know, I've written everything correctly.

When attempting to install an extension (AdBlock with ID gighmmpiobklfepjocnamgkkbiglidom), I get a few errors:

An error occurred:  Error: Invalid extensionReference passed in: "undefined"
    at install (C:\Users\zacha\Documents\Code Projects\Yugen Electron Wrapper\node_modules\electron-devtools-installer\dist\index.js:49:31)
    at App.<anonymous> (C:\Users\zacha\Documents\Code Projects\Yugen Electron Wrapper\main.js:21:5)
    at App.emit (node:events:513:28)
(node:18196) ExtensionLoadWarning: Warnings loading extension at C:\Users\zacha\AppData\Roaming\yugen-electron-wrapper\extensions\lmhkpmbekcpmknklioeibfkpmmfibljd:
  Manifest version 2 is deprecated, and support will be removed in 2023. See https://developer.chrome.com/blog/mv2-transition/ for more details.
  Permission 'notifications' is unknown or URL pattern is malformed.
  Permission 'contextMenus' is unknown or URL pattern is malformed.

(Use `electron --trace-warnings ...` to show where the warning was created)
Added Extension:  Redux DevTools

It seems as though it doesn't see the new extension IDs I put in? I'm not entirely sure. However my code looks like this:

const electron = require('electron');
const { app, BrowserWindow } = electron;

const { default: installExtension, REDUX_DEVTOOLS, gighmmpiobklfepjocnamgkkbiglidom } = require('electron-devtools-installer');

let mainWindow;

app.on('ready', () => {

    installExtension(REDUX_DEVTOOLS)
        .then((name) => console.log(`Added Extension:  ${name}`))
        .catch((err) => console.log('An error occurred: ', err));

    installExtension(gighmmpiobklfepjocnamgkkbiglidom)
        .then((name) => console.log(`Added Extension:  ${name}`))
        .catch((err) => console.log('An error occurred: ', err));

    mainWindow = new BrowserWindow({
        width: 1000,
        height: 700
    });

    mainWindow.setTitle('YouTube');
    mainWindow.loadURL('https://youtu.be');
    mainWindow.setMenu(null);

    mainWindow.on('closed', () => {
        mainWindow = null;
    });
});

Again, as far as I know, I'm writing the code properly. Please let me know if there's anything I can do to fix this?

jamesremuscat commented 1 year ago

installExtension(gighmmpiobklfepjocnamgkkbiglidom)

You want to pass a string in here, as the variable gighmmpiobklfepjocnamgkkbiglidom is not exported from electron-devtools-installer and is therefore undefined (as the error message says).

Kyanoxia commented 1 year ago

installExtension(gighmmpiobklfepjocnamgkkbiglidom)

You want to pass a string in here, as the variable gighmmpiobklfepjocnamgkkbiglidom is not exported from electron-devtools-installer and is therefore undefined (as the error message says).

Ah! I knew it was me! Sorry about the clutter, and thank you for the help!