We are building an Electron application and have been able to work on it, and build it using Linux and Mac OS. When we move it to a Windows machine in development or when build on a Mac OS machine then ran on the Windows machine, it fails.

When we follow the instructions here it says,

vue add electron-builder
yarn electron:serve

should run the application. On a fresh install using Windows this fails for us.


When we try and start the application on Windows we get an error,

TypeError electron__WEBPACK_IMPORTED_MODULE_0__.protocol.registerStandardSchemes is not a function


This line comes with the boilerplate when we add Electron Builder to the app that seems to be throwing the error.

protocol.registerStandardSchemes(['app'], { secure: true })

It is being used like this,

import { protocol} from 'electron'
protocol.registerStandardSchemes(['app'], { secure: true })
// Helper to create our main view BrowserWindow
function createWindow() {
  // Create the browser window.
  win = new BrowserWindow({ width: 800, height: 600 })

  if (process.env.WEBPACK_DEV_SERVER_URL) {
    // Load the url of the dev server if in development mode
    if (!process.env.IS_TEST) win.webContents.openDevTools()
  } else {
    // Load the index.html when not in development

What We Tried

When I console.log protocol the only key available is, registerSchemesAsPrivileged which is in the docs but not what came with the boiler and nor does it work. I can see at this page that the registerStandardSchemes is referenced in a paragraph but it is not well explained in it's own section like the rest of the methods on that page.


What does one need to do to access the method, protocol.registerStandardSchemes(['app'], { secure: true }) when running an Electron-Builder application scaffold with Vue CLI 3 on Windows 10?

0 Answers