Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron builder - Unable to find a valid app #633

Closed
acuemor opened this issue Aug 3, 2016 · 7 comments · May be fixed by qcif/data-curator#563
Closed

Electron builder - Unable to find a valid app #633

acuemor opened this issue Aug 3, 2016 · 7 comments · May be fixed by qcif/data-curator#563

Comments

@acuemor
Copy link

acuemor commented Aug 3, 2016

  • Version: 5.22.1
  • Target: Windows 7 x64

After building App with Electron builder, when I try to open my setup application, I get the following error:

A javascript error occurred in the main process. Unable to find a valid app at electron.asar

The build is success, but on start:

A JavaScript error occurred in the main process Uncaught Exception: Error: Unable to find a valid app at Object.<anonymous> (E:\Project\dist\win-unpacked\resources\electron.asar\browser\init.js:128:9) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) at tryModuleLoad(module.js:417:12) at Function.Module._load (module.js:409:3) at Function.Module.runMain (module.js:575:10) at run (bootstrap_node.js:360:7) at startup (bootstrap_node.js:152:9) at bootstrap_node.js:497:3

This is my electron asar under dist/win-unpacked/resource

This is my package.json

Thanks in advance!

@develar
Copy link
Member

develar commented Aug 3, 2016

main is specified as build/main.min.js, but no such file in the asar.

It seems your files is not correct:

"files": [ "build\/**\/*", "node_modules\/**\/*" ]

You don't need to escape /, must be just:

"files": [ "build/**/*", "node_modules/**/*" ]

@acuemor
Copy link
Author

acuemor commented Aug 3, 2016

@develar Actually, I have two .asar files (app asar and electron.asar) under my dist/resources directory. Is this the expected behavior?

In app.asar, build/main.min.js really exist, but the error I get is referencing to electron.asar. I don't understand the reason:

unpacked\resources\electron.asar\browser\init.js:128:9)

@develar
Copy link
Member

develar commented Aug 3, 2016

Yes, electron.asar it is pre bundled electron implementation. Does your app work before pack using electron-prebuilt? Maybe you can send me link to project code?

@acuemor
Copy link
Author

acuemor commented Aug 4, 2016

Previously, I created a tag and build my app with electron-packager:

node_modules/.bin/electron-packager . MyApp --platform=win32 --arch=x64 --icon='/home/user/Desktop/logo.ico' --asar=true --prune --overwrite

It worked fine! The problem is that now, for this release, I create a new tag, but I try to build my app with electron builder instead. I get the error discussed above.

Furthermore, I try to build my app again with electron packager, but it didn't work now! I get the same problem.

I checkout my app to the previoulsy working tag, and it neither work.

Unfortunately, the code can not be distributed

Thanks!

@develar
Copy link
Member

develar commented Aug 4, 2016

Unfortunately, the code can not be distributed

Well, your code in any case is exposed when you build app :) You can send me exe file ;)

@acuemor
Copy link
Author

acuemor commented Aug 4, 2016

Hi @develar ,

I solve the problem with electron packager. The problem was a directory containing technical docs (pdf, docs) inside the repository. I don't know the reason but this creates the exception.

However, the problem continues with Electron Builder, which it is really what I need.
I have created a example app based on mine. The same problem occurs. Here is the project code
I try changing "electron-prebuilt" from dev-dependency to dependency, getting this another error

@develar
Copy link
Member

develar commented Aug 4, 2016

  • electron-prebuilt must be not in the dependencies — should be in the devDependencies.
  • your files is not correct, must be "files": ["build/**/*","node_modules/**/*", "package.json"] Do you see? You missed package.json. This file must be included.

This issue will be closed automatically — I will add checks to prevent such misconfiguration in the future.

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

Successfully merging a pull request may close this issue.

2 participants