_From @Sulman633 on August 30, 2016 1:36_
Android
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
Error calling module function
Error: com.tns.NativeScriptException: Failed to find module: "nativescript-angular/application", relative to: /app/tns_modules/
com.tns.Module.resolvePathHelper(Module.java:220)
com.tns.Module.resolvePath(Module.java:60)
com.tns.Runtime.runModule(Native Method)
com.tns.Runtime.runModule(Runtime.java:241)
com.tns.Runtime.run(Runtime.java:235)
com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
android.app.ActivityThread.-wrap1(ActivityThread.java)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:148)
android.app.ActivityThread.main(ActivityThread.java:5417)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
File: "
StackTrace:
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'/data/data/org.nativescript.nightlive/files/app/main.js', line: 3, column: 21
Frame: function:'require', file:'', line: 1, column: 266
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: com.tns.NativeScriptException:
Error calling module function
Error: com.tns.NativeScriptException: Failed to find module: "nativescript-angular/application", relative to: /app/tns_modules/
com.tns.Module.resolvePathHelper(Module.java:220)
com.tns.Module.resolvePath(Module.java:60)
com.tns.Runtime.runModule(Native Method)
com.tns.Runtime.runModule(Runtime.java:241)
com.tns.Runtime.run(Runtime.java:235)
com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
android.app.ActivityThread.-wrap1(ActivityThread.java)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:148)
android.app.ActivityThread.main(ActivityThread.java:5417)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
File: "
StackTrace:
Frame: function:'require', file:'', line: 1, column: 266
Frame: function:'', file:'/data/data/org.nativescript.nightlive/files/app/main.js', line: 3, column: 21
Frame: function:'require', file:'', line: 1, column: 266
at com.tns.Runtime.runModule(Native Method)
at com.tns.Runtime.runModule(Runtime.java:241)
at com.tns.Runtime.run(Runtime.java:235)
at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
... 8 more
This error started showing up after I tried to install Telerik UI for Nativescript, then I rimrafed the plugin since it was causing issues only to still have this error show up every time I tried to use livesync. I tried removing android platform and re-adding it again as well as removing hooks but that didn't help either. I have to get my hooks folder back, I don't exactly know how to so please advise on that also.
_Copied from original issue: NativeScript/NativeScript#2641_
_From @Sulman633 on August 30, 2016 1:58_

I have the import statement in the right area and as you can see the module is in fact in my file structure. I have also already tried removing node_modules and doing npm install which still didn't work.
We had this problem too, it's a bug with newer npm and {N}.
See this issue and work around
https://github.com/telerik/nativescript-ui-samples-angular/issues/3#issuecomment-238081589
Our workaround was to add an file .npmrc at the root of the our {N}-project with this content:
legacy-bundling=true
Remove platforms and node_modules and reinstall.
@m-abs @enchev
I followed instructions created the .npmrc file and gave it the same contents, then rimrafed node_modules and platforms. Installed them both back again and when I went and used live-sync the same error showed up again. Any other suggestions or workarounds? So in essence this is an issue with npm 3 file structuring? Or is this caused when one tries to install telerik-ui for nativescript?
The error is due to a breaking change introduced with the support for ng-rc5 and the new NgModule stuff. nativescript-angular/application module is deleted and application bootstrap is moved to nativescript-angular/platform module. You can take a look at template-hello-world-ng repo which demonstrates how to add new application bootstrap point.
@nsndeck @vchimev I have created a new project with your template and added android platform but when I do tns run android there are files it cannot find. I also ran npm install just in case too after adding the platform.
This is what the file structure looks like as well:
@nsndeck @vchimev any progress on this issue or fix to the template?
Closing since since 1.0.0 we now use nativescript-angular/platform module.
I added the plugin nativescript-loading-indicator, and started receiving the same error as mentioned in the above post: Failed to find module "nativescript-loading-indicator", relative to: app/tns_modules/.
Any suggestion to fix this?
@zsf3 make sure loading indicator is in your package dependencies section.
Then delete platforms folder and node_modiles folder.
Then: tns run ios --emulator
Lemme know.
If still an issue please link me to your shared project and I could submit a PR to help.
Most helpful comment
We had this problem too, it's a bug with newer npm and {N}.
See this issue and work around
https://github.com/telerik/nativescript-ui-samples-angular/issues/3#issuecomment-238081589
Our workaround was to add an file
.npmrcat the root of the our {N}-project with this content:Remove
platformsandnode_modulesand reinstall.