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.

ERR_FILE_NOT_FOUND index.ff634a51.js and index.62f502b0 only after build my app

See original GitHub issue
  • Electron-Builder Version: 23.0.3
  • Node Version: 14.16.0
  • Electron Version:18.2.0
  • Electron Type (current, beta, nightly):current
  • Target: Mac, Linux, Windows

Hi, Im new using Electron, my actual stack is Vite + React + Electron + Electron-builder When I build my app it works correctly (in local)

good I don’t have any type of error or issue, but when im pass that file .dmg or .deb or .exe the electron app initialise in white screen and the console shows the next issues, Before, I also had another similar error, I was missing the preload.js error and I solved it by adding the following lines:

"files": [
       ...
      "preload.js"
    ],

But as you can see I also agree ./dist/**/* line in files, that’s should work.

MAC

error LINUX

error Linux

My package.json is:

{
  "name": "testeb",
  "author": {
    "name": "test",
  },
  "description": "Test app vite electron react",
  "private": false,
  "version": "0.0.1",
  "homepage": "./",
  "main": "main.js",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "electron:start": "electron .",
    "pack": "electron-builder --dir",
    "dist": "electron-builder",
    "postinstall": "electron-builder install-app-deps"
  },
  "dependencies": {
    "react": "^18.0.0",
    "react-dom": "^18.0.0"
  },
  "devDependencies": {
    "@types/react": "^18.0.0",
    "@types/react-dom": "^18.0.0",
    "@vitejs/plugin-react": "^1.3.0",
    "vite": "^2.9.9",
    "electron": "18.2.0"
  },
  "build": {
    "appId": "test app",
    "icon": ".dist/assets/favicon.17e50649.svg",
    "directories": {
      "output": "dist"
    },
    "extraFiles": [
      "./dist/assets/**"
    ],
    "files": [
      "./dist/**/*",
      "main.js",
      "preload.js"
    ],
    "linux": {
      "target": [
        "deb"
      ]
    },
    "mac": {
      "target": [
        {
          "target": "dmg",
          "arch": [
            "x64"
          ]
        }
      ]
    },
    "win": {
      "target": [
        "portable"
      ]
    }
  }
}

My main.js file for Electron is:

const { app, BrowserWindow } = require("electron");
const path = require("path");
const url = require("url");

function createWindow() {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      contextIsolation: true,
      preload: path.join(__dirname, "preload.js"),
    },
  });

  win.loadFile("./dist/index.html");
  win.webContents.openDevTools();
}

app.whenReady().then(() => {
  createWindow();

  app.on("activate", () => {
    if (BrowserWindow.getAllWindows().length === 0) {
      createWindow();
    }
  });
});

app.on("window-all-closed", () => {
  if (process.platform !== "darwin") {
    app.quit();
  }
});

and my preload.js is:

window.addEventListener("DOMContentLoaded", () => {
    const replaceText = (selector, text) => {
      const element = document.getElementById(selector);
      if (element) element.innerText = text;
    };
  
    for (const type of ["chrome", "node", "electron"]) {
      replaceText(`${type}-version`, process.versions[type]);
    }
  });
  

I hope someone can help me with my issue, regards.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
EliasLeguizamon123commented, Jun 7, 2022

Well the issue persist, in my personal Mac works, but in second Mac doesn’t work, I think in linux still fail too, I change my package.json and re install electron-builder, to make my installer I use npm run dist maybe that’s my problem, how do you make the installer for Windows?

1reaction
EliasLeguizamon123commented, Jun 6, 2022

Wow, let me check this, and i inform you if i can do it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - ERR_FILE_NOT_FOUND index.ff634a51.js and ...
Hi, Im new using Electron, my actual stack is Vite + React + Electron + Electron-builder When I build my app it works...
Read more >
it is saying this in my extension ERR_FILE_NOT_FOUND how ...
Hello,. Some developers have also found that the ERR_FILE_NOT_FOUND error occurs when developing Chrome extensions. This is usually because a ...
Read more >
How to fix the Whitescreen After a Static Deployment with ...
Do you know how annoying it is to stare at a blank screen after you deployed a static React app? Learn how to...
Read more >
A quick guide to help you understand and create ReactJS apps
js : This is the javascript file corresponding to index.html. This file has the following line of code which is very significant. ReactDOM.render ......
Read more >
How To Set Up a React Project with Create React App
When you installed Node, you also installed a package managing application called npm . npm will install JavaScript packages in your project and ......
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