Venemo / node-lmdb

Node.js binding for lmdb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mkdirp throws error on running benchmark

detj opened this issue · comments

Problem

On running benchmark via npm run benchmark or node benchmark/index.js, I get the error.

/tmp/node-lmdb/node_modules/mkdirp/lib/opts-arg.js:13
    throw new TypeError('invalid options argument')
    ^

TypeError: invalid options argument
    at optsArg (/tmp/node-lmdb/node_modules/mkdirp/lib/opts-arg.js:13:11)
    at mkdirp (/tmp/node-lmdb/node_modules/mkdirp/index.js:11:10)
    at /tmp/node-lmdb/benchmark/index.js:28:5
    at next (/tmp/node-lmdb/node_modules/rimraf/rimraf.js:69:7)
    at CB (/tmp/node-lmdb/node_modules/rimraf/rimraf.js:100:9)
    at /tmp/node-lmdb/node_modules/rimraf/rimraf.js:226:7
    at FSReqCallback.oncomplete (fs.js:180:23)

Reproduce

  1. Clone the project
  2. Run npm install
  3. Run npm run benchmark

Investigation

The issue seems to be that mkdirp@1.0.4 is specified as a devDependency in package.json, but mkdirp@1.x returns a promise, while the code in benchmark/index.js is written using a callback.

To verify the version of mkdirp installed, run npm ls mkdirp

node-lmdb@0.9.4 /tmp/node-lmdb
├── mkdirp@1.0.4
└─┬ node-gyp@7.1.0
  └─┬ tar@6.0.5
    └── mkdirp@1.0.4 deduped

Changing the benchmark code to use promise solves the problem.

Fix

To resolve, this issue, either change the benchmark code to use Promises or use any version of mkdirp@0.x