igorklopov / enclose

Compile your Node.js project into an executable
http://enclosejs.com
Other
936 stars 43 forks source link

Support LevelDOWN #105

Closed derekstavis closed 7 years ago

derekstavis commented 8 years ago

I have been using linvodb3, which uses leveldown module underneath.

I get an error while trying to use it in the following steps:

  1. on a shell

    npm install linvodb3 leveldown # For pure node.js, using LevelDB

  2. the file test.js
var LinvoDB = require("linvodb3");
LinvoDB.dbPath = process.cwd(); 
var Doc = new LinvoDB("doc", {})
  1. run enclose

    enclose -o test test.js

  2. run final binary
*** Evaluation version. Please subscribe to full version.

/thebox/<redacted>/node_modules/levelup/lib/util.js:54
    throw requireError(e)
    ^
LevelUPError: Failed to require LevelDOWN (index out of range). Try `npm install leveldown` if it's missing
    at requireError (/thebox/<redacted>/node_modules/levelup/lib/util.js:60:10)
    at getLevelDOWN (/thebox/<redacted>/node_modules/levelup/lib/util.js:54:11)
    at LevelUP.open (/thebox/<redacted>/node_modules/levelup/lib/levelup.js:114:37)
    at new LevelUP (/thebox/<redacted>/node_modules/levelup/lib/levelup.js:87:8)
    at LevelUP (/thebox/<redacted>/node_modules/levelup/lib/levelup.js:47:12)
    at Function.console./thebox/<redacted>/node_modules/linvodb3/lib/model.js.Model.initStore (e:0)
    at new Model (e:0)
    at Object.console./thebox/<redacted>/test.js.dev (e:0)
    at Object.Module._extensions..js (module.js:416:10)

The dependencies are installed correctly, you can see that even leveldown is being listed as installed:

$ npm list
...
├── leveldown@1.4.6
├─┬ linvodb3@3.19.0
│ ├── async@1.5.2
│ ├─┬ bagpipe@0.3.7 (git://github.com/ivshti/bagpipe.git#97881f59aeee25bad66f8542fe80f19d1a281c93)
│ │ └── inherits@2.0.2 (git://github.com/ivshti/inherits.git#0c5b02ddc4172bf2e55460916401ac37cfe6f9d3)
│ ├─┬ binary-search-tree@0.2.6
│ │ └── underscore@1.4.4
│ ├── hat@0.0.3
│ ├─┬ levelup@1.3.2
...

A note from LevelUP docs:

As of version 0.9, LevelUP no longer requires LevelDOWN as a dependency so you must npm install leveldown when you install LevelUP.

igorklopov commented 8 years ago

Hi. LevelDown is known to work well with Enclose. Please post a simple example, illustrating the malfunction.

derekstavis commented 8 years ago

Sorry for the initial issue body, I was in a hurry at that time. I have updated issue's OP with more details, please give a check.

igorklopov commented 8 years ago

index out of range means you have node v5 installed on your system, and you enclose your project with v4 runtime. run node -v and adjust your compilation command line adding -v and version number. You may look at file binaries.json. This ambiguity will be removed soon.

igorklopov commented 7 years ago

Dear users of EncloseJS! I highly encourage you to switch to https://github.com/zeit/pkg It is rewritten successor of EncloseJS. It is open source, and all improvements will go there. Please check if pkg has your issue unresolved, and if it is true, reopen your issue there: https://github.com/zeit/pkg/issues