dat-ecosystem/dat

dat init fails with "Error: Module did not self-register"

waldoj opened this issue · 5 comments

I ran a fresh install of dat, ran dat init, and this happened:

$ dat init
module.js:355
  Module._extensions[extension](this, filename);
                               ^
Error: Module did not self-register.
    at Error (native)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/dat/node_modules/leveldown-prebuilt/index.js:5:18)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

I've got no idea of how to proceed.

Is it possible that I installed Node via Homebrew (I'm 80% sure I didn't), and that this error is resulting from that? (I took this to #dat in IRC, but nobody seemed to be around.)

hmm this looks like an old version of dat to me. what does npm ls -g dat return?

cshum commented

I also got similar message using a recent dat:

$ npm ls -g dat
/usr/local/lib
└── dat@7.0.2
$ dat init
module.js:519
    paths.unshift(path.resolve(homeDir, '.node_modules'));
                       ^
Error: Module did not self-register.
    at Error (native)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/dat/node_modules/leveldown-prebuilt/prebuilt.js:5:18)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

@cshum hmm this looks super weird since we don't depend on leveldown-prebuilt anymore. if you reinstall dat does this still happen? and could share the output from npm install as well

cshum commented

A reinstall works for me, thanks @mafintosh. Probably just caused by the leveldown-prebuilt leftover from previous versions.

Added this to the readme.