2016-04-06 10 views
0

Ich benutze nativescript, um Android-Anwendung zu erstellen und mit der Datenbank ist Orientdb auf der Homepage http://orientdb.com/. Ich versuche Orientdb in Nativescript zu verbinden, benutze npm Orientjs auf der Homepage https://www.npmjs.com/package/orientjs, aber habe einen Fehler. Im Folgenden ist der Installationsprozess:
Schritt 1: i Befehl npm install orientjs --save hier ist der Code in package.jsonVerwenden Sie nicht npm Orientjs in Nativescript

{ 
    "nativescript": { 
    "id": "org.nativescript.KerryExpressDelivery", 
    "tns-android": { 
     "version": "1.7.1" 
    } 
    }, 
    "dependencies": { 
    "orientjs": "^2.1.11", 
    "tns-core-modules": "1.7.1" 
    } 
} 

Schritt 2: Ich benutze Befehl var orientDb = require("orientjs"); in file.js aber wenn Build-App in Emulator, bekommen Fehler

com.tns.NativeScriptException: Failed to find module: "net", relative to: /app/tns_modules/ 
    at com.tns.Module.resolvePathHelper(Module.java:220) 
    at com.tns.Module.resolvePath(Module.java:60) 
    at com.tns.Platform.callJSMethodNative(Native Method) 
    at com.tns.Platform.dispatchCallJSMethodNative(Platform.java:816) 
    at com.tns.Platform.callJSMethod(Platform.java:715) 
    at com.tns.Platform.callJSMethod(Platform.java:694) 
    at com.tns.Platform.callJSMethod(Platform.java:684) 
    at com.tns.gen.android.view.View_OnClickListener_ftns_modules_ui_button_button_l19_c42__.onClick(android.view.View$OnClickListener.java) 
    at android.view.View.performClick(View.java:4438) 
    at android.view.View$PerformClick.run(View.java:18422) 
    at android.os.Handler.handleCallback(Handler.java:733) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at android.os.Looper.loop(Looper.java:136) 
    at android.app.ActivityThread.main(ActivityThread.java:5001) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method. 

Antwort

4

Dies ist wahrscheinlich, weil Orientdb einige andere Knotenmodule verwendet, die in NativeScript nicht funktionieren. Obwohl {N} auf JS basiert, funktionieren nicht alle npm-Module sofort. NPM Module, die von Browser- oder Knotenobjekten abhängen, funktionieren nicht.

+0

danke für die hilfe –