question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't render pug files using `electron-forge start`

See original GitHub issue
  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue:

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

screenshot from 2017-08-11 00 09 37

Put the console output here

What command line arguments are you passing?

Put the arguments here

What does your config.forge data in package.json look like?

Paste the config.forge JSON object here

"config": {
        "forge": {
            "make_targets": {
                "win32": [
                    "squirrel"
                ],
                "darwin": [
                    "zip"
                ],
                "linux": [
                    "deb",
                    "rpm"
                ]
            },
            "electronPackagerConfig": {
                "packageManager": "npm"
            },
            "electronWinstallerConfig": {
                "name": "foo"
            },
            "electronInstallerDebian": {},
            "electronInstallerRedhat": {},
            "github_repository": {
                "owner": "",
                "name": ""
            },
            "windowsStoreConfig": {
                "packageName": "",
                "name": "foo"
            }
        }

Please provide either a failing minimal testcase (with a link to the code) or detailed steps to reproduce your problem. Using electron-forge init is a good starting point, if that is not the source of your problem.

Hello I have created a simple app using electron-forge init Until here if I run electron-forge start the default app appears and everything is working fine.

However in my app I want to use pug templates.To do this I have installed electron-pug using npm install --save electron-pug.

Here is the complete code of my default index.js file after adding electron-pug:

const { app, BrowserWindow } = require('electron');
const pug = require('electron-pug')({pretty:true},{});
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
const createWindow = () => {
  // Create the browser window.
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
  });
  // and load the index.html of the app.
  mainWindow.loadURL(`file://${__dirname}/demo.pug`);
  // Open the DevTools.
  mainWindow.webContents.openDevTools();
  // Emitted when the window is closed.
  mainWindow.on('closed', () => {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });
};
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit();
  }
});
app.on('activate', () => {
  // On OS X it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (mainWindow === null) {
    createWindow();
  }
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.

And here is the code for for demo.pug file:

doctype
html
    head
        title Nope
    body
        h1 Hello
        p  
        | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

Now if I run npm start which in turn calls electron-forge start my pug file won’t render and it will log the following error in my console: Pug interceptor failed: Error: The scheme has been intercepted

Here is a screenshot of my app when running npm start" screenshot from 2017-08-11 00 20 54

However if I runelectron src/index.js from the root of my project folder my pug file will be rendered producing the following output:

screenshot from 2017-08-11 00 22 55

Any ideas how I can fix that.I really need to use electron-forge in some projects which use electron-pug

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
maleptcommented, Aug 10, 2017

And here is the code for for demo.pug file

You probably want to put that code in a block so formatting, etc. are preserved.

0reactions
MarshallOfSoundcommented, Apr 16, 2018

Using electron-pug should work 🆗 in Electron Forge 6.0.0 as we don’t enable electron-compile support by default. Docs will be up soon explaining how to use 6.0.0-beta.X and you should be able to pick those up 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't render pug files using electron-forge start #291 - GitHub
Please describe your issue: Console output when you run electron-forge with the environment variable DEBUG=electron-forge:* . (Instructions on ...
Read more >
How to render pugjs on electron? - javascript - Stack Overflow
I am trying to use pug on electron. I have a question my second . pug file is not rendered correctly, it just...
Read more >
Sapper and Electron : r/sveltejs - Reddit
My 'dream' setup for any project would be to have Sapper, Electron-Forge, Webpack and Babel working and configurable. My current svelte-electron ...
Read more >
Newest 'electron' Questions - Stack Overflow
I am creating an electron app with react. I am using electron forge 6 with Webpack Template and React 18. I am quite...
Read more >
[Solved]-pug use i18n in the template file-node.js
compileFile explicitly with the template defeats the purpose of having an express middleware ... Electron Forge - Can't use ipcRenderer in the renderer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found