TeamMaestro / angular-native-seed

Build web apps and NativeScript applications from one codebase using the AngularCLI.
265 stars 71 forks source link

Crash on Startup [ERROR BOOTSTRAPPING ANGULAR] #91

Open yolanother opened 6 years ago

yolanother commented 6 years ago

I checked out a fresh copy of angular-native-seed and ran npm run android. It appears to build properly and run, but as soon as the app starts it force closes. I don't see any warnings or errors during the build.

Exception: JS: ERROR Error: [object Object] JS: ERROR CONTEXT [object Object] JS: ns-renderer: ERROR BOOTSTRAPPING ANGULAR JS: ns-renderer: [object Object] JS: JS: Error: [object Object] JS: at viewWrappedDebugError (file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:9786:15) [angular] JS: at callWithDebugContext (file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:15088:15) [angular] JS: at Object.debugCreateRootView [as createRootView] (file:///data/data/com.domain.project/files/app/tnsmodules/@angular/core/bundles/core.umd.js:14361:12) [angular] JS: at ComponentFactory.create (file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:11258:46) [angular] JS: at ComponentFactoryBoundToModule.create (file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:4050:29) [angular] JS: at ApplicationRef.bootstrap (file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:5877:57) [angular] JS: at file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:5604:81 [angular] JS: at Array.forEach (native) [angular] JS: at PlatformRef._moduleDoBootstrap (file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:5604:44) [angular] JS: at file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:5525:27 [angular] JS: at Object.onInvoke (file:///data/data/com.domain.project/files/app/tns_modules/@angular/core/bundles/core.umd.js:4772:33) [angular]

Tompote commented 6 years ago

I opened an issue yesterday so I started from a fresh seed and I didn't run into the same issue. Maybe you could try to delete your node_modules and platform folders and run npm install before running the project again.

yolanother commented 6 years ago

I managed to get it working on another system. Still no luck with this system. On both machines I had to manually unlink the nativescript/src/fonts directory which was pointed to some random absolute path. On the linux box (the one I got it working on) I then had to create relative symlinks to the fonts and assets directories. I thought the whole point of running npm run android instead of tns run android was to do the symlinking steps, but for some reason I had to do it manually.

yolanother commented 6 years ago

Manually symlinking also fixed the problem on the mac. On my Linux machine the stack trace was actually useful. The error produced showed that the translations json file was missing from assets. This lead me to find that assets wasn't being properly symlinked. I'm not sure why the errors are different between systems.

danielfigueroaj commented 6 years ago

@yolanother how many symlinks did manually created? and where? I'm facing the same issue: "../assets/i18n/en.json", relative to: app/app/

Thank you!

yolanother commented 6 years ago

These are the symlinks that need to be correct: nativescript/src/app -> src/app nativescript/src/assets -> src/assets nativescript/src/fonts -> src/fonts

danielfigueroaj commented 6 years ago

Thank you, I'm gonna try to fix it

vinitMundada commented 6 years ago

@danielfigueroaj I am getting this symlink error JS: Error: com.tns.NativeScriptException: Failed to find module: "../assets/i18n/en.json", relative to: app/app/

Do you know a fix ?

danielfigueroaj commented 6 years ago

@sevenOneHero what I did was this:

First removed all symlinks: rm /home/user/projects/angular-native-seed/nativescript/src/app rm /home/user/projects/angular-native-seed/nativescript/src/fonts rm /home/user/projects/angular-native-seed/nativescript/src/assets

Created symlinks again: ln -s /home/user/projects/angular-native-seed/src/app /home/user/projects/angular-native-seed/nativescript/src/app ln -s /home/user/projects/angular-native-seed/src/fonts /home/user/projects/angular-native-seed/nativescript/src/fonts ln -s /home/user/projects/angular-native-seed/src/assets /home/user/projects/angular-native-seed/nativescript/src/assets

Then just run the app: npm run android.phone