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.

Packaging up Create-react-app and electron error

See original GitHub issue

I am packaging up my electron app electron-builder" after I build the Create-react-app react-scripts build.

The error I receive when I try to run my packaged app is:

Not allowed to load local resource: 
file:///Users/profile/app/dist/mac/App.app/Contents/Resources/app.asar/build/index.html

Am I missing a step, to package the react app with electron?

the main.js is one level deeper in from the build folder,

Here is the url in my main.js

const startUrl = process.env.ELECTRON_START_URL || url.format({
        pathname: path.join(__dirname, '/../build/index.html'),
        protocol: 'file:',
        slashes: true
  });

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ryan-dscommented, Aug 31, 2018

Still not working. I’m getting a blank screen

1reaction
develarcommented, Jul 31, 2017

Please consider to use short form like file://${__dirname}/../build/index.html

Have you read https://medium.com/@kitze/️-from-react-to-an-electron-app-ready-for-production-a0468ecb1da3? What electron-builder version do you use?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to build an Electron app using create-react-app ... - Medium
I recently built an Electron app using create-react-app. I didn't need to muck about with Webpack, or “eject” my app, either. I'll walk...
Read more >
Building a desktop app with Electron and Create React App
A step-by-step tutorial explaining how to create a desktop application using Create React App (CRA) and Electron.
Read more >
React App Not Loading into The Packaged Electron App
I ran npm run build first to package my react application so that i would actually have a build folder. In my case,...
Read more >
Electron Apps Made Easy with Create React App and Electron ...
Import the project into the Electron Forge workflow so that it can easily be packaged up for distribution. We'll take care of the...
Read more >
Create React App without Create React App - Bits and Pieces
Step by Step · 1. Make sure node is installed in your system · 2. Create project folder and package.json · 3. Install...
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