Home / GitHub Page

Installing and using a new dependency throws an error "Error: Module did not self-register."

I am trying to work this issue which aims to save passwords to the system keychain rather than the database. For doing this, a dependency (keytar) needs to be installed.

I tried installing it using:

cd ReactNativeClient
npm install keytar

I changed to the ReactNativeClient directory because that’s where the dependency needs to be used (in ReactNativeClient/lib/models/Setting.js). The module seems to have installed perfectly. I checked ReactNativeClient/node_modules for keytar folder. And it seems to be there.

Now, when I start the ElectronClient using

cd ../ElectronClient
npm start

it throws me an error saying Uncaught Exception: Error: Module did not self-register. .

I have tried the solutions from this StackOverflow question. But, none of them seem to solve my problem.

Below is my error trace when I do npm start from ElectronClient:

Error trace
jyuvaraj03@Gutsy:~/gsoc/joplin/ElectronClient$ npm start

> Joplin@1.0.194 start /home/jyuvaraj03/gsoc/joplin/ElectronClient
> gulp build -L && electron . --env dev --log-level debug --no-welcome --open-dev-tools

Copying to /home/jyuvaraj03/gsoc/joplin/ElectronClient/tools/../gui/note-viewer/pluginAssets
Copying to /home/jyuvaraj03/gsoc/joplin/ElectronClient/tools/../pluginAssets
App threw an error during load
Error: Module did not self-register.
    at process.func (electron/js2c/asar.js:140:31)
    at process.func [as dlopen] (electron/js2c/asar.js:140:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:922:18)
    at Object.func (electron/js2c/asar.js:140:31)
    at Object.func [as .node] (electron/js2c/asar.js:140:31)
    at Module.load (internal/modules/cjs/loader.js:735:32)
    at Module._load (internal/modules/cjs/loader.js:648:12)
    at Module._load (electron/js2c/asar.js:717:26)
    at Function.Module._load (electron/js2c/asar.js:717:26)
    at Module.require (internal/modules/cjs/loader.js:775:19)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Module did not self-register.
    at process.func (electron/js2c/asar.js:140:31)
    at process.func [as dlopen] (electron/js2c/asar.js:140:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:922:18)
    at Object.func (electron/js2c/asar.js:140:31)
    at Object.func [as .node] (electron/js2c/asar.js:140:31)
    at Module.load (internal/modules/cjs/loader.js:735:32)
    at Module._load (internal/modules/cjs/loader.js:648:12)
    at Module._load (electron/js2c/asar.js:717:26)
    at Function.Module._load (electron/js2c/asar.js:717:26)
    at Module.require (internal/modules/cjs/loader.js:775:19)

you probably need to add the package to the ElectronClient directory as well because it’s being used by the ElectronClient.

I tried that too. It throws the same error.

Edit: It works after I did npm install keytar followed by npm install inside ElectronClient. Thanks!

1 Like