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

Application entry can't be found #371

Closed
caibirdme opened this issue Apr 29, 2016 · 31 comments · May be fixed by qcif/data-curator#563
Closed

Application entry can't be found #371

caibirdme opened this issue Apr 29, 2016 · 31 comments · May be fixed by qcif/data-curator#563
Labels

Comments

@caibirdme
Copy link

Hey,all
I followed the two package.json structure in the document, but when I ran npm run build, it reported an error that Application entry file couldn't be found in package.Seems like a wrong configuration
2016-04-29 10 46 43

the package.json in the root of the project is:

  ...
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "postinstall": "install-app-deps",
    "clean": "rimraf dist",
    "build": "build"
  },
  "build": {
    "app-bundle-id": "com.smartstudy.toefl",
    "app-category-type": "public.app-category.education"
  },
  ...

and the structure of app directory is:
2016-04-29 10 51 07
the package.json in app directory is:

{
  "name": "toefl",
  "version": "0.0.1",
  "description": "this is toefl-pc",
  "main": "./index.js",
  "private": true,
  "author": "caibirdme",
  "license": "ISC",
  "dependencies": {
    "request": "^2.71.0",
    "sequelize": "^3.21.0",
    "sqlite3": "^3.1.3"
  }
}

version:
node 5.10.0
npm 3.8.3
electron 0.37.5
electron-builder 3.13.1

@Vj3k0
Copy link

Vj3k0 commented Apr 29, 2016

Try setting "main" property in your root package.json to be "app/index.js"

@develar
Copy link
Member

develar commented Apr 29, 2016

@Vj3k0 Fix will be tomorrow, for now I suggest just set version to 3.11.0

@develar
Copy link
Member

develar commented Apr 29, 2016

@caibirdme Cannot reproduce. Test passed for me.

Notes:

  1. "clean": "rimraf dist", Please do not — electron-builder does it for you, — simplify your package.json and reduce build time.
  2. Don't specify main explicitly — if file named as index.js, you don't need to specify it at all.

@demetris-manikas Maybe do you have any idea?

@demetris-manikas
Copy link
Contributor

@caibirdme is there an app.asar being built? If so could you provide the output of asar list app.asar?
@develar unfortunately I won't be able to do any tests before Monday.

@demetris-manikas
Copy link
Contributor

@caibirdme can you also please explain what is the "electron" listing in your app folder?

@caibirdme
Copy link
Author

@demetris-manikas I think it maybe a problem of asar...if I add "asar": false in package.json, everything will be ok. My project is divided into three parts,: front_end,back_end and electron.electron is the only directory which has access to electron-api and will export functions that will be used in back_end or front_end

@demetris-manikas
Copy link
Contributor

@caibirdme can you also answer to my previous question as well?

@Vj3k0
Copy link

Vj3k0 commented May 4, 2016

You can use externalResources to set data which needs to be accessed outside of asar. Asar is not considered a folder so path is broken to resource which is packed in it.
Does that help?

@caibirdme
Copy link
Author

@demetris-manikas Sorry for my late reply,I was busy completing my dissertation.There is a app.asar in the foo.app/Contents/Resource.and when I ran ../../../../../node_modules/.bin/asar app.asar there's nothing listed.That is to say the app.asar is empty.

@caibirdme
Copy link
Author

@Vj3k0 I use app.getPath to get the appData directory of one user and put all file to that place and app.asar should only contain my code.

@demetris-manikas
Copy link
Contributor

@caibirdme asar app.asar doesn't output anything anyway. Try running

../../../../../node_modules/.bin/asar list app.asar

@caibirdme
Copy link
Author

@demetris-manikas list command return an error.

../../../../../node_modules/.bin/asar list app.asar
undefined:1
{"files":{"electron":{"files":{"copyDb.js":{"size":599,"offset":"0"},"storeLocal.js":{"size":7346,"offset":"599"}}},"index.js":{"size":3149,"offset":"7945"},"node_modules":{"files":{"ansi-regex":{"files":{"index.js":{"size":135,"offset":"11094"},"license":{"size":1119,"offset":"11229"},"package.json":{"size":2504,"offset":"12348"},"readme.md":{"size":593,"offset":"14852"}}},"ansi-styles":{"files":{"index.js":{"size":1254,"offset":"15445"},"license":{"size":1119,"offset":"16699"},"package.json":{"size":2438,"offset":"17818"},"readme.md":{"size":1448,"offset":"20256"}}},"asn1":{"files":{".npmignore":{"size":19,"offset":"21704"},".travis.yml":{"size":44,"offset":"21723"},"lib":{"files":{"ber":{"files":{"errors.js":{"size":239,"offset":"21767"},"index.js":{"size":469,"offset":"22006"},"reader.js":{"size":5589,"offset":"22475"},"types.js":{"size":638,"offset":"28064"},"writer.js":{"size":7587,"offset":"28702"}}},"index.js":{"size":320,"offset":"36289"}}},"LICENSE":{"size":1076,"offset":"36609"},"pack

SyntaxError: Unexpected end of input
    at Object.parse (native)
    at Object.module.exports.readArchiveHeaderSync (/Users/deenjun/TOEFL-PC/node_modules/asar/lib/disk.js:97:20)
    at Object.module.exports.readFilesystemSync (/Users/deenjun/TOEFL-PC/node_modules/asar/lib/disk.js:105:21)
    at Object.module.exports.listPackage (/Users/deenjun/TOEFL-PC/node_modules/asar/lib/asar.js:175:17)
    at Command.<anonymous> (/Users/deenjun/TOEFL-PC/node_modules/asar/bin/asar:42:23)
    at Command.listener (/Users/deenjun/TOEFL-PC/node_modules/commander/index.js:301:8)
    at emitTwo (events.js:100:13)
    at Command.emit (events.js:185:7)
    at Command.parseArgs (/Users/deenjun/TOEFL-PC/node_modules/commander/index.js:615:12)
    at Command.parse (/Users/deenjun/TOEFL-PC/node_modules/commander/index.js:458:21)

@demetris-manikas
Copy link
Contributor

@caibirdme So it seems that electron-builder error message is misleading and should be fixed (I 'll create a PR soon).
Can you confirm that the problem still arises on the latest stable release of electron-builder (3.17.1)?
Can also you clarify the OS on which your build fails? The output shows building on darwin but in 366 you mention that the error occurs when building on win7-x64. Thanks

@gamestailer94
Copy link

gamestailer94 commented May 21, 2016

Still get that error.
https://ci.appveyor.com/project/gamestailer94/quest-editor/build/1.0.42#L336
https://travis-ci.org/gamestailer94/quest-editor/jobs/131848606#L545

and the asar file is empty, if I run asar list app.asar I get an new Line and thats all

@demetris-manikas
Copy link
Contributor

@gamestailer94 I saw that you reverted to electron-builder 3.11.
What is the result of asar list app.asar now?

@gamestailer94
Copy link

gamestailer94 commented May 21, 2016

Still empty, was just somethink i tryed in hope that it will wor.
https://travis-ci.org/gamestailer94/quest-editor/jobs/131896362#L906
https://travis-ci.org/gamestailer94/quest-editor/jobs/131896363#L617
no windows build, because no find on win ....

@demetris-manikas
Copy link
Contributor

@gamestailer94 Good. This is why the warning is there. To safeguard you from publishing a "successful" build. I 'll try to reproduce and I' ll get back to you.

@demetris-manikas
Copy link
Contributor

demetris-manikas commented May 21, 2016

@gamestailer94 Can you please try setting the packageName equal to name in app/package.json and try again? There is an open bug (#360) when defining different values for the two.

@demetris-manikas
Copy link
Contributor

@develar I reproduced the problem on linux and solved it as described above. I would be happy to create a PR to solve #360 but I will need some guidance. It is not very clear to me when to use name and when productName during the build process.

@develar
Copy link
Member

develar commented May 21, 2016

@demetris-manikas We should use productName in all cases except publish (we provide special names for publisher) and specific Linux cases. In the code this.appName it is a productName.

If we have myapp.app as result, but product name is MyApp, it means that we don't pass product name to electron-packager correctly — see https://github.com/electron-userland/electron-builder/blob/master/src/platformPackager.ts#L126 Maybe we should pass productName as well here (we use my fork — https://github.com/develar/electron-packager).

@gamestailer94
Copy link

Can Confirm if ProductName and name are indetical it works

@develar
Copy link
Member

develar commented May 23, 2016

@demetris-manikas I will do it. name is build will be prohibited. I don't want configuration hell. It is not what users want. Why it is was allowed before? My mistake — forgot to forbid.

It will be not warning, but error — just because it doesn't work in any case.

@develar
Copy link
Member

develar commented May 23, 2016

Duplicate #360

@demetris-manikas Thanks for investigation.

@demetris-manikas
Copy link
Contributor

@develar gamestailer94's problem has to do with another thing. gamestailer94 used as productName a value like "[QS] blah blah" and after investigating it turned out that the directory name is used by asar as a RegExp to find the files to add in the asar ( if [] exists the RegEpx fails to list anything and thus the empty asar file.
The fix can be applied at electron-builder or electron-packager-tf or asar itself and consists in escaping the src dir for RegExp usage (escape-string-regexp package did the trick for me).
I will file a PR soon at asar. but for fast usage the electron-packager-tf or electron-builder would do.

@develar develar added bug and removed duplicate labels May 24, 2016
@develar develar reopened this May 24, 2016
@demetris-manikas
Copy link
Contributor

After giving a thought the pattern as source is an asar's feature so I wont be fileing a PR there. Would you like me to file a PR at electron-packager-tf ?

@develar
Copy link
Member

develar commented May 24, 2016

@demetris-manikas Proper fix should be not escaping, but disable RegExp handling on asar side.

After giving a thought the pattern as source is an asar's feature so I wont be fileing a PR there.

It is a pitfall. We pass path as path, not pattern. And should be simple way to disable regex instead of trying to escape it.

@demetris-manikas
Copy link
Contributor

@develar Point taken. I 'll PR at asar and see what happens.

@demetris-manikas
Copy link
Contributor

PR created. electron/asar#68

@demetris-manikas
Copy link
Contributor

demetris-manikas commented May 24, 2016

@develar I don't fight with anyone. I am just proposing a solution to a problem. Escaping the directory in electron-packager is for me the right solution. The problem is clear and the fix as well. You take it from here. :)

develar added a commit to develar/electron-builder that referenced this issue Jun 2, 2016
develar added a commit to develar/electron-builder that referenced this issue Jun 3, 2016
@develar develar closed this as completed in a7b2932 Jun 3, 2016
@fritx
Copy link

fritx commented Nov 7, 2016

Awesome avatar 😂 @caibirdme

@caibirdme
Copy link
Author

@fritx Thx for ur praise

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

Successfully merging a pull request may close this issue.

6 participants