leveldb open error: IO error lock ./db/LOCK: already held by process

1.9k views Asked by At

I'm a beginner creating a leveldb and dont really know whats going on here. My db.js file has an initalizaing problem thats causing a lock error. I think I only have one process but its telling me i'm doing something multiprocess which i dont understand. Is there an f.database function to fix this?

// db.js

var levelDb = require('level');  
var dbPath = './db';  

var options = 
{   //keyEncoding: 'binary',
valueEncoding: 'json'
};


function puts(msg) 
{   if(typeof msg === 'object')
{   msg = JSON.stringify(msg);
}
process.stdout.write(msg + '\n');
}

puts('open db');
var db = levelDb(dbPath, options);

module.exports = db;
0

There are 0 answers