Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Workflow fails when following README guide - Application entry file "main.js does not exist #76

Open
abulka opened this issue Dec 18, 2021 · 4 comments

Comments

@abulka
Copy link

abulka commented Dec 18, 2021

The README guide suggests using https://www.electron.build/ and thus electron-webpack-quick-start as a recommended way to create a new Electron application. Following this advice results in a project containing index.js files which I think is the cause of the GitHub Actions error

Application entry file "main.js" does not exist.

which I get after creating the recommended build.yml file and pushing the project to GitHub. Here is the GitHub Actions error:

start1/static
  ⨯ Application entry file "main.js" in the "/Users/runner/work/electron-webpack-quick-start1/electron-webpack-quick-start1/dist/mac/electron-webpack-quick-start.app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration.  stackTrace=
                                                                                                                                                                                                                                                        Error: Application entry file "main.js" in the "/Users/runner/work/electron-webpack-quick-start1/electron-webpack-quick-start1/dist/mac/electron-webpack-quick-start.app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration.
error Command failed with exit code 1.
                                                                                                                                                                                                                                                            at error (/Users/runner/work/electron-webpack-quick-start1/electron-webpack-quick-start1/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:7:12)
                                                                                                                                                                                                                                                            at checkFileInArchive (/Users/runner/work/electron-webpack-quick-start1/electron-webpack-quick-start1/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:33:11)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
/Users/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:144
				throw err;
				^

Error: Command failed: yarn run electron-builder --mac  
    at checkExecSyncError (child_process.js:621:11)
    at execSync (child_process.js:657:15)
    at run (/Users/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:21:27)
    at runAction (/Users/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:132:4)
    at Object.<anonymous> (/Users/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:150:1)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 1824,
  stdout: null,
  stderr: null
}

Following this project's instructions should result in a working GitHub Actions run. At the very least, some instructions should be provided to either change the electron-webpack-quick-start project files to be compatible with the build.yml file described in this project's README.md, or vice versa. I'm not familiar enough with webpack and the tooling to know how to do this.

@khevamann
Copy link

khevamann commented Jan 11, 2022

Are you using typescript? If so make sure that your build script in package.json includes tsc -p electron. I ran into this issue because I was only compiling the source for my typescript React project but not the electron entry points.

I have this for a react electron app

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build && tsc -p electron",
    "test": "react-scripts test",
    "postinstall": "electron-builder install-app-deps",
    "electron:dev": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://localhost:3000 && tsc -p electron -w\" \"wait-on http://localhost:3000 && tsc -p electron && electron .\"",
    "electron:build": "yarn build && tsc -p electron && electron-builder",
    "eject": "react-scripts eject"
  },

@abulka
Copy link
Author

abulka commented Jan 11, 2022

There is no typescript in my project:

electron-webpack-quick-start1
 ├──package.json 
 ├──README.md 
 ├──src 
 │  ├──main 
 │  │  └──index.js 
 │  └──renderer 
 │     └──index.js 
 └──yarn.lock 

My package.json is

{
  "name": "electron-webpack-quick-start",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "dev": "electron-webpack dev",
    "compile": "electron-webpack",
    "dist": "yarn compile && electron-builder",
    "dist:dir": "yarn dist --dir -c.compression=store -c.mac.identity=null"
  },
  "dependencies": {
    "source-map-support": "^0.5.16"
  },
  "devDependencies": {
    "electron": "8.2.0",
    "electron-builder": "^22.4.1",
    "electron-webpack": "^2.8.2",
    "webpack": "~4.42.1"
  }
}

@khevamann
Copy link

Ok, it is looking for main.js and you have your entry point as main/index.js. I believe what you want is to add "main": "build/src/index.js" to package.json as your entry point. You can run your dist script and see what the default file it creates is then use that

@wildone
Copy link

wildone commented Feb 23, 2022

yeah you need to add at least "main": "your index file"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants