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

Failed to find module: "nativescript-vuforia", relative to: app/tns_modules/ #88

Open
vidrepar opened this issue Jun 15, 2017 · 4 comments

Comments

@vidrepar
Copy link

Hi, I'm just starting with NS and I'm experimenting with argon-app for my next project.

My configuration:

  • NativeScript 3.0.3
  • My system: Ubuntu 14.04
  • Occurs on Android
  • Sdks installed: 22, 23, 24, 25 in platforms directory

The app gets built, installed either in emulator or on actual device, but I get this error when I open the app and I can't find a solution.

I suspect this happens for one of the following reasons:

  • different versions of NS ( globally on my computer: 3.0.3, package.json in the project: 2.5.0 )
  • path to the directory in package.json ( directory is not empty )
"nativescript-vuforia": "file:plugins/nativescript-vuforia"

The error:


An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: 
Error calling module function 
Error calling module function 
Error calling module function 
Error: com.tns.NativeScriptException: Failed to find module: "nativescript-vuforia", relative to: app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:159)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:580)
    com.tns.Runtime.run(Runtime.java:574)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4793)
    android.app.ActivityThread.access$1900(ActivityThread.java:152)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:135)
    android.app.ActivityThread.main(ActivityThread.java:5538)
    java.lang.reflect.Method.invoke(Native Method)
    java.lang.reflect.Method.invoke(Method.java:372)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
File: "<unknown>, line: 1, column: 265
StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/edu.gatech.ael.argon4/files/app/components/common/argon-vuforia-provider.js', line: 4, column: 15
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/edu.gatech.ael.argon4/files/app/components/common/AppViewModel.js', line: 7, column: 32
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/edu.gatech.ael.argon4/files/app/app.js', line: 29, column: 22
    Frame: function:'require', file:'', line: 1, column: 266
Error: com.tns.NativeScriptException: Failed to find module: "nativescript-vuforia", relative to: app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:159)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:580)
    com.tns.Runtime.run(Runtime.java:574)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4793)
    android.app.ActivityThread.access$1900(ActivityThread.java:152)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:135)
    android.app.ActivityThread.main(ActivityThread.java:5538)
    java.lang.reflect.Method.invoke(Native Method)
    java.lang.reflect.Method.invoke(Method.java:372)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
File: "<unknown>, line: 1, column: 265
StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/edu.gatech.ael.argon4/files/app/components/common/argon-vuforia-provider.js', line: 4, column: 15
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/edu.gatech.ael.argon4/files/app/components/common/AppViewModel.js', line: 7, column: 32
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/edu.gatech.ael.argon4/files/app/app.js', line: 29, column: 22
    Frame: function:'require', file:'', line: 1, column: 266
Error: com.tns.NativeScriptException: Failed to find module: "nativescript-vuforia", relative to: app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:159)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:580)
    com.tns.Runtime.run(Runtime.java:574)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4793)
    android.app.ActivityThread.access$1900(ActivityThread.java:152)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:135)
    android.app.ActivityThread.main(ActivityThread.java:5538)
    java.lang.reflect.Method.invoke(Native Method)
    java.lang.reflect.Method.invoke(Method.java:372)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    com.andro

Any idea how to fix it?

@speigg
Copy link
Contributor

speigg commented Jun 15, 2017

Try tns plugin add plugins/nativescript-vuforia, then try building and running again

@vidrepar
Copy link
Author

Awesome, it worked! Thanks @speigg

I had to execute:

tns plugin add plugins/nativescript-vuforia
tns plugin add plugins/argon-web-view
tns plugin add plugins/nativescript-webworkers

And then:

tns  build android
tns run android

There was also an unrelated issue. The app opened on Huawei P8 Lite ( ALE-21, Android 5.0.1, EMUI 3.1 ) but the examples didn't work. Examples worked perfectly on P9 Lite ( Android 6.0 ).

@blairmacintyre
Copy link
Contributor

We targeted Android 6.0 or higher, so I'm not surprised it doesn't work on the P8. I'm not sure what the exact dependencies are on 6.0, but if you figure out how to get it working, we'd be happy to support older devices.

I'm curious what caused the need for having to manually do the tns plugin add commands. @speigg any ideas? I think all of us do development on Macs ... is this a Linux thing (you said you're on Ubuntu) or something else?

Regardless, and PR you can do to help make this work better (including just updating the README) is welcome!

@speigg
Copy link
Contributor

speigg commented Jun 15, 2017

I'm also not sure why the tns plugin add commands are necessary in this case, but I'm glad the workaround is easy enough! Btw, you probably don't need tns plugin add plugins/nativescript-webworkers, as we are no longer using it at all internally.

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

No branches or pull requests

3 participants