ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

Starting ipfs with the wrong node version leaves the repo locked #1522

Closed achingbrain closed 1 year ago

achingbrain commented 6 years ago

Type: Bug

Severity: Medium

Description:

Installing js-ipfs with one version of node then starting it with another crashes the process leaving the repo lock file in place.

Steps to reproduce the error:

For example use node 10 to install js-ipfs then run it with node 8, it explodes as you'd expect:

$ jsipfs files mkdir --help
/path/to/js-ipfs/node_modules/ipfs-repo/node_modules/bindings/bindings.js:88
        throw e
        ^

Error: The module '/path/to/js-ipfs/node_modules/ipfs-repo/node_modules/leveldown/build/Release/leveldown.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

..but then realise your mistake and switch back to node 10:

$ jsipfs files mkdir --help
/path/to/js-ipfs/src/cli/utils.js:68
    throw err
    ^

Error: can't lock file /Users/me/.jsipfs/repo.lock: has non-zero size
    at fs.stat (/path/to/js-ipfs/node_modules/ipfs-repo/node_modules/lock-me/src/unix.js:11:19)
    at FSReqWrap.oncomplete (fs.js:153:5)
achingbrain commented 1 year ago

We've been through several iterations of lockfile implementation since this was reported, closing due to staleness.