Search code examples
nativescriptnedb

Failed to find module: "crypto", relative to: /app/tns_modules


I tried using NeDB in NativeScript application, but could do it... it throws error saying this:

Blockquote java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Failed to find module: "crypto", relative to: /app/tns_modules/ 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: Failed to find module: "crypto", relative to: /app/tns_modules/ at com.tns.Module.resolvePathHelper(Module.java:220) at com.tns.Module.resolvePath(Module.java:60) 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.RuntimeHelper.initRuntime(RuntimeHelper.java:129) at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:13) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707) ... 8 more

I first did npm install nedb --save and require it by

var nedb = require('nedb');

How can I fix it?


Solution

  • There are a number of npm modules that would not work because most of the node core modules are not available to use in NativeScript as yet you can track the issue here