Skip to content

Always get Application entry point file not found #197

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

Closed
michaellee8 opened this issue Dec 27, 2016 · 27 comments
Closed

Always get Application entry point file not found #197

michaellee8 opened this issue Dec 27, 2016 · 27 comments
Labels

Comments

@michaellee8
Copy link

I am working on my own angular+nativescript app but found Application entry point file not found that even the bare project just ran tns create --ng proj and tns add platform android show the error above every time I try to run it. Then I tried to test the angular-end of sample-Groceries as well but the error still exists. It happens even when I use bare javascript from the end branch.

@michaellee8
Copy link
Author

michaellee8 commented Dec 27, 2016

By inspecting the apk, it seems that the *.ts files are not compiled.

@NickIliev
Copy link
Contributor

NickIliev commented Dec 27, 2016

@michaellee8 Can you post your TypeScript plugin version.
I your package.json something like "nativescript-dev-typescript": "^0.3.1",

For some reason, your typescript translation is not working and your entry point file is not transpired to javascript. You can check your version of TypeScript (tsc --version) and also can make sure that you have installed TypeScript in your project.

tns install typescript

Take a look at this discussion here

@michaellee8
Copy link
Author

michaellee8 commented Dec 27, 2016

tsc -version
Version 2.1.4

I think the above one should be the --global installed version by npm install --global typescript where I just did it.
In my package.json, I have

"devDependencies": {
        "zone.js": "~0.6.21",
        "typescript": "~2.0.10",
        "nativescript-dev-typescript": "^0.3.2",
        "nativescript-dev-android-snapshot": "^0.*.*"
 }

Thanks for your help

EDIT: Even I installed the typescript globally, the issue still exists

@NickIliev
Copy link
Contributor

NickIliev commented Dec 27, 2016

@michaellee8 I've tried to reproduce but with no avail.
I have created an Angular project and I've used Node.js 7.3.0 and 6.9.2 and also tried with TypeScript 2.0.10 and 2.1.4 using the official NativeScript CLI (2.4.2) and tried every possible combination but still at my side the problem can not be reproduced.

The test project that I have created is located here - perhaps you can try to clone it and run it at your side just to see if the error is consistent.

I am kinda suspecting the TypeScript version is responsible for not transpiring your entry point file (btw you can check your secondary in-app package.json in the app folder and make sure it does have an entry point something like "main": "main.js") and if you ar using VSCode it might ask you for which version of TypeScript to use (if the global one is different from the bundled one).
The prompt looks like this and based on my experience I am always setting to use the workspace version. (in this case 2.0.10)

typescript_workspace

@michaellee8
Copy link
Author

michaellee8 commented Dec 27, 2016

It seems that the build tool fail to transcompile all the *.ts files to the *.js files, and they remain the same in the name-debug.apk package from platform/android/build/output. The nodejs version is the current LTS version while the nativescript is the one downloaded through npm a few days ago. Interestingly, when I try import those sample-Groceries repo into the Telerik Platform and run it, there are many error. But if I follow the tutorial as a trial user in the platform of the gallery app, it works greatly. I don't know the reason behind these, may be my computer config wrong or bad project template. I just ran the below in a 32-bit win 7, connecting to a real android 4.x phone and error comes:

tns create --ng projName

tns add platform android

tns run android

I have already rum tns doctor when I install the dependecies once i install npm install -g nativescript, may be I can run it again when I got my computer again, but I believe the result will be the same.

Edit: i typed this for a while on my phone so I may miss out your previous comment on :30.

@michaellee8
Copy link
Author

Just for confirm, would you like to list out all the commands required to build this app assumung from the folder you provided? something like npm install or etc. is required?

@NickIliev
Copy link
Contributor

@michaellee8 if you run directly in project

tns run android

It will step by step add the platform (Android), then build the project, then deploy it on the connected devices and finally start it.
So basically tns run android will do (in a app with deleted node_modules and platforms)

tns platform add android
npm install
tns build android
tns run android  // deploy and start

Of course, if some of the commands are already executed (e.g. your platform is already added or your project is already built) then this step will be dismissed and the next in line will be executed

If you want to explicitly run all the commands you can delete your node_modules and platforms folders which will force the respective commands to be triggered (npm install and tns platform add) before the build, deploy and start of your application.

@michaellee8
Copy link
Author

I created an app, let say R, with tns create --ng R, then I downloaded your version, let say L. I delete everything except those in app folder in R, so the directory structure is same as L. I further checked that if L and R are idenctial, then I found that the only difference is that L has every single *.js files for every *.js files, while R only have *.js files. I verifies these with WinMerge in the two folders. Then I run the 4 commands that you mentioned above, the result ia that R still get the error, while L run smoothly.

Now I can conclude that this behavior is because those TypeScript are not transcompiled to JavaScript, so the android runtime cannot find the js file, making it breaks.

The problem remains, how may I make those script transcompiles? Thank you.

I don't mind reinstalling everything if it really needs.

@michaellee8
Copy link
Author

It seems that when my package compiler compiles your provided app, the apk file still contains the *.ts files, which is a little bit buggy I think.

@michaellee8
Copy link
Author

michaellee8 commented Dec 28, 2016

Any update on this one? thx.
I believe this problem is because the `nativescript' cli does not recgonise those typescript files somehow

@NickIliev
Copy link
Contributor

@michaellee8 can't think of anything else apart from that perhaps your TypeScript is not installed properly and causing these side effects. I've tried your configuration on my side (Node 7.3 and TS 2.1.4) and everything works as expected - the sample project I posted above was created with this configuration.

You can try to open your project (TypeScript or Angular-2) and run tsc manually. The result should be that your *.js files are created. If this does not happen to take a look at your tsconfig.json file and also try to downgrade your TypeScript to 2.0.10. If you are using VSCode make sure that it respects your workspace settings preferable to the bundled one.
Also if you had multiple Node.js manual installs make sure that you are using the right PATH in your environment settings.

@michaellee8
Copy link
Author

both tsc and tns are properly installed with --version shown.
However, in console output, I saw the suspicious following:

Found peer TypeScript 2.0.10
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Any thoughts on that?

@NickIliev
Copy link
Contributor

@michaellee8 it is probably related to this issue and there is a possible solution and also a fix applied to [email protected].

To update your dev dependency you can remove your node_modules folder and change the dependency in your package.json to 0.3.3 and then rebuild your app.

@michaellee8
Copy link
Author

Sorry for missing your reply because I am quite busy these days.
problem still there with [email protected], any new bug?

@NickIliev
Copy link
Contributor

NickIliev commented Jan 4, 2017

@michaellee8 can you share via archive or GitHub a sample project that is reproducing this issue!?
You can also try to create a totally new project, unable login and check if it is running as expected

tns create myApp --ng
tns run android --log trace > log.txt

Af the error persist, please send us the log.txt file generated by the command above ( plus the package.json content of your project if you can not send us the whole project)

@michaellee8
Copy link
Author

the windows console outputs: https://gist.github.com/michaellee8/d290c05d54311ee2c33d2ef7183e3412
log.txt: https://gist.github.com/michaellee8/d51b1fb0c40ac8d64f81d0dcd55a6e88
Please consider re-open this issue.

@NickIliev NickIliev reopened this Jan 4, 2017
@NickIliev
Copy link
Contributor

NickIliev commented Jan 4, 2017

@Pip3r4o, @slavchev thoughts on that !?

@slavchev
Copy link

slavchev commented Jan 4, 2017

Hi @michaellee8

The provided logs suggest that it is low memory issue. What version of Node.js and java do you use? If you currently use 32-bit ones, is it an option to switch to 64-bit ones?

@michaellee8
Copy link
Author

node is the latest lts, which should be 6.9.2 in my memory, java is jdk from oracle version 1.8_101, running in a 32-bit old version of win 10, so I am forced to do -Xms512M ( as memory) to prevent causing the java could not allocate memory bug, in envrionment variable JAVA_OPTIONS, as existed when I ran gradle previously

@slavchev
Copy link

slavchev commented Jan 4, 2017

If possible I would suggest as an immediate step to play with -Xms/x parameters and try to relax the constraints as much as possible. Meanwhile I will try to come up with more detailed system requirements and update them accordingly.

@michaellee8
Copy link
Author

michaellee8 commented Jan 4, 2017

Problem still exists even removing -Xms
Proably I don't have enough memory for 4GB here since RAM in 32-bits are limited to 3.52GB

@michaellee8
Copy link
Author

Just installed Ubuntu 16.04 LTS 64-bit a few days ago on the same computer above. Testing nativescript on it again and found it works smoothly, and all typescript all compiled. Maybe there are some bugs in my windows 10.

@NickIliev
Copy link
Contributor

@michaellee8 I guess the 32-bit limitation for your operating memory was causing this behaviour (as @slavchev suggested) so upgrading to 64-bit OS was a good idea.

@JulienFr
Copy link

JulienFr commented May 10, 2017

@michaellee8 you could have also probably do it like in NativeScript/nativescript-cli#2756 without upgrading

@madmat-it
Copy link

madmat-it commented May 26, 2017

Hello,

same issue here. I managed to solve my problem. I'm wondering whether my solution would work for you as well. Actually for me it was quite easy - antyvirus software run gradle and other programs in sandbox separated from real file system. So build was really completed but no result on HDD as the result was stored in sandbox, indeed.

Please try to turn off all kind of antyvirus/firewall/sandboxing software for a while (for ex. 15 minutes) and try to run once again. If now works fine - you'll have to put all tns related binaries on white list in sandboxing program.

try:

tns build android

check if apk is there

tns run android

Best Regards

@gabitoesmiapodo
Copy link

Same problem here, Mac user. It's something I'm working on, based on the Groceries sample app.

It only happens with "tns run android" (iOS is fine).

The .ts files are copied in platforms/android/src/main/assets/app but not .js files are generated. They are generated on the root ./app (development) folder if I use "tns run ios", though. So TS seems to be working.

Strangely, if I build the project for release (that is, with a .keystore file, etc.), the project is correctly built. But still, I can't use the emulation for debugging.

I have currently installed TS 2.3.3 globally, and 2.2.1 on my project. Using TNS 3.0.1 currently

I tried deleting node_modules, hooks and platforms several times.

Packages are:

"dependencies": {
"@angular/animations": "~4.1.0",
"@angular/common": "~4.1.0",
"@angular/compiler": "~4.1.0",
"@angular/core": "~4.1.0",
"@angular/forms": "~4.1.0",
"@angular/http": "~4.1.0",
"@angular/platform-browser": "~4.1.0",
"@angular/router": "~4.1.0",
"nativescript-angular": "~3.0.0",
"nativescript-localize": "^2.0.1",
"nativescript-telerik-ui": "^2.0.1",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.3.0",
"tns-core-modules": "^3.0.1",
"zone.js": "~0.8.2"
},
"devDependencies": {
"babel-traverse": "6.24.1",
"babel-types": "6.24.1",
"babylon": "6.17.1",
"lazy": "1.0.11",
"nativescript-dev-sass": "^1.1.1",
"typescript": "~2.2.1",
"nativescript-dev-typescript": "~0.4.0"
}

@HemantSPawar
Copy link

HemantSPawar commented Jun 16, 2017

(VS Code)
1.npm install typescript@latest
2.ctrl+shift+p(configure task runner)
3.select tsconfig file
4.ctrl+shift+b(transpile all ts to js)
5.done

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

No branches or pull requests

7 participants