Open pablocid opened 7 years ago
Cab you please show me the code to reproduce this issue?
this code work's fine:
import { Component } from "@angular/core";
import fs = require("file-system");
require('nativescript-nodeify');
var Nedb = require('nedb');
@Component({
selector: "my-app",
template: `... `
})
export class AppComponent {
constructor(){
// in-memory
var db = new Nedb({autoload: true });
var doc = {...};
db.insert(doc, function (err, newDoc) {});
}
}
this not and throw the error:
...
constructor(){
var path = fs.knownFolders.documents()+'/database.db';
// setting the filename path
var db = new Nedb({ filename: path, autoload: true });
var doc = { ... };
db.insert(doc, function (err, newDoc) {});
}
}
Thanks for the details!
Looks like we need to shim the fs
module a bit more. Just created this issue to take care of that.
That was quite some work. But a fix for using the filesystem is in place in 0.5.4. It works well with the code you provided, but I haven't tested beyond that, so please let me know how it goes.
Work's perfectly EddyVerbruggen !!!!.
Thank's and greetings from Chile. As we say in Chile, "te pasaste weon, eri terrible tela"
Bye
Ha, "Graag gedaan", as we say over here in The Netherlands 💬 👍
Hi EddyVerbruggen, I'm in troubles with Nedb and nativescript-nodeify again because of new update of nativescript.
the error in console: (the origin code is the same of above but always show the error)
05-31 12:42:50.808 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fixtures
05-31 12:42:50.808 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream/test
05-31 12:42:50.809 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson
05-31 12:42:50.809 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test
05-31 12:42:50.809 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/examples
05-31 12:42:50.809 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse
05-31 12:42:50.809 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules
05-31 12:42:50.809 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream/examples
05-31 12:42:50.809 3993 3993 D Sync : Failed to delete temp sync directory: /data/local/tmp/org.nativescript.Test/sync/tns_modules/http-browserify/example/json-stream/node_modules/JSONStream
error in the phone: Exception
An uncaught Exception occurred on "main" thread. java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
Error calling module function
TypeError: Cannot read property 'toString' of undefined File: "file:///data/data/org.nativescript.VTb2/files/ app/tns_modules/pbkdf2/index.js, line: 3, column: 21
StackTrace:
Frame: function:", file:'file:///dataidatai org.nativescript.VTb2/filesiappitns_modules/ pbkdf2/index.js, line: 3, column: 22
Frame: function:'require, file:", line: 1, column: 266
Frame: function:", file:'file:///data/data/ org.nativescript.VTb2/filesiappitns_modules/ crypto-browserifyiindex.js, line: 12, column: 9
Frame: function:'require, file:", line: 1, column: 266
Frame: function:", file:'file:///data/datai org.nativescript.VTb2/filesiappAns_modulesinedb/ lib/customUtils.js, line: 1, column: 74
Frame: function:'require, file:", line: 1, column: 266
Frame: function:", file:'file:///dataidatai org.nativescript.VTb2/filesiappitns_modulesinedb/ lib/datastore.js, line: 1, column: 79
Frame: function:'require, file:", line: 1, column: 266
Frame: function:", file:'file:///data/datai org.nativescript.VTb2/files/appitns_modulesinedb/ index.js, line: 1, column: 77
Frame: function:'require, file:", line: 1, column: 266
Frame: function:", file:'file:///data/datai org.nativescript.VTb2/filesiappiapp.component.js, line: 5, column: 12
Frame: function:'require, file:", line: 1, column: 266
Frame: function:", file:'file:///data/data/ org.nativescript.VTb2/files/app/app.module.js, line: 5, column: 23
Frame: function:'require, file:", line: 1, column: 266
Frame: function:", file:'file:///data/data/ org.nativescript.VTb2/files/app/main.js, line: 4, column: 20
Frame: function:'require, file:", line: 1, column: 266
...
help!!!
I'll take a look but what platform and what command exactly are you using? Perhaps share your repo so I can easily reproduce?
Here, I created a test repo
Hello there, I'm trying to use Nedb in nativescript through this plugin. Nedb have an option to utilize in-memory database, which work perfectly, but in persistance (file storage mode) throw this console error:
I'nt find anything in google. Any idea?
Thank's