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

[bug] Basic example - NPM version issue #100

Open
Granipouss opened this issue Aug 28, 2018 · 2 comments
Open

[bug] Basic example - NPM version issue #100

Granipouss opened this issue Aug 28, 2018 · 2 comments

Comments

@Granipouss
Copy link

Hi,

I had a lot of issues setting up the librairy so I tested ou the basic example.

var LinvoDB = require("linvodb3");

// The following two lines are very important
// Initialize the default store to Medeadown - which is a JS-only store which will work without recompiling in NW.js / Electron
LinvoDB.defaults.store = { db: require("medeadown") }; // Comment out to use LevelDB instead of Medea
// Set dbPath - this should be done explicitly and will be the dir where each model's store is saved
LinvoDB.dbPath = process.cwd();

var Doc = new LinvoDB("doc", { /* schema, can be empty */ })

var d = new Doc();

d.name = "test";
d.saved = new Date();

d.save(function() {
	console.log("saved document with _id: " + d._id);
	Doc.count({},function(err, n) {
		console.log("document count "+n)
	});
});

with the following package.json

{
  "dependencies": {
    "linvodb3": "^3.25.2",
    "medeadown": "^1.1.9"
  }
}

And I have the following error:

.\node_modules\levelup\lib\levelup.js:53
    throw error
    ^
InitializationError: First argument must be an abstract-leveldown compliant store
    at new LevelUP (.\node_modules\levelup\lib\levelup.js:49:13)
    at LevelUP (.\node_modules\levelup\lib\levelup.js:33:12)
    at Function.Model.initStore (.\node_modules\linvodb3\lib\model.js:79:100)
    at new Model (.\node_modules\linvodb3\lib\model.js:52:35)
    at Object.<anonymous> (.\index.js:9:11)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

What am I doing wrong ?

@Granipouss Granipouss changed the title [bug] Basic example [bug] Basic example - NPM version issue Aug 29, 2018
@Granipouss
Copy link
Author

Apparently the version that I downloaded from NPM (the 3.25.2) does not have the same code as in the repo. It does not use encode-down for instance.
It works fine when I download for the git reposotory

@Ivshti
Copy link
Owner

Ivshti commented Aug 29, 2018

The published version is currently broken, as you've already discovered

try this branch: #95

I will merge and publish shortly

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

2 participants