Home / GitHub Page

Npm start throws uncaught error

Hi,
So I cloned the repo https://github.com/laurent22/joplin into my local machine (macOS Mojave) and then in the root I ran “npm install”
Then I went inside the ElectronClient Directory to run the Desktop app of Joplin.
But inside when I ran “npm start” the following error was thrown

Uncaught Error: Cannot find module ‘/Users/biswarupbanerjee/Desktop/Dream/joplin/ElectronClient/node_modules/sqlite3/lib/binding/electron-v7.1-darwin-x64/node_sqlite3.node’
Require stack:

  • /Users/biswarupbanerjee/Desktop/Dream/joplin/ElectronClient/node_modules/sqlite3/lib/sqlite3.js
  • /Users/biswarupbanerjee/Desktop/Dream/joplin/ElectronClient/lib/database-driver-node.js
  • /Users/biswarupbanerjee/Desktop/Dream/joplin/ElectronClient/lib/BaseApplication.js
  • /Users/biswarupbanerjee/Desktop/Dream/joplin/ElectronClient/app.js
  • /Users/biswarupbanerjee/Desktop/Dream/joplin/ElectronClient/index.html
    at Module._resolveFilename (internal/modules/cjs/loader.js:717)
    at Function…/lib/common/reset-search-paths.ts.Module._resolveFilename (reset-search-paths.ts:40)
    at Module._load (internal/modules/cjs/loader.js:622)
    at Module._load (electron/js2c/asar.js:717)
    at Function.Module._load (electron/js2c/asar.js:717)
    at Module.require (internal/modules/cjs/loader.js:775)
    at require (internal/modules/cjs/helpers.js:68)
    at Object. (/Users/biswarupbanerjee/Desktop/Dream/joplin/ElectronClient/node_modules/sqlite3/lib/sqlite3.js:4)
    at Object. (/Users/biswarupbanerjee/Desktop/Dream/joplin/ElectronClient/node_modules/sqlite3/lib/sqlite3.js:209)
    at Module._compile (internal/modules/cjs/loader.js:880)

I tried reinstalling node_modules yet nothing happened.

Any help will be appreciated.
Thanks
#gsoc-2020

Is sqlite3 is installed in your machine ?

Hi @sapsa
Yes, it is installed.
When I run sqlite3 I get this in my terminal:

SQLite version 3.24.0 2018-06-04 14:10:15
Enter “.help” for usage hints.
Connected to a transient in-memory database.

Maybe there is some version mismatch?

So I did a bit more research and found this:
“The latest version of SQLite always comes pre-installed within Mac OSX or macOS. You don’t have to download or install anything else, it’s located in the directory” (reference: https://tableplus.com/blog/2018/08/download-install-sqlite-for-mac-osx-in-5-minutes.html)

I have the same issue!
Tried to install from source on Ubuntu18.04 ARM64 machine…

Uncaught Error: Cannot find module ‘/home/michael/joplin/ElectronClient/node_modules/sqlite3/lib/binding/electron-v7.1-linux-arm64/node_sqlite3.node’
Require stack:

  • /home/michael/joplin/ElectronClient/node_modules/sqlite3/lib/sqlite3.js
  • /home/michael/joplin/ElectronClient/lib/database-driver-node.js
  • /home/michael/joplin/ElectronClient/lib/BaseApplication.js
  • /home/michael/joplin/ElectronClient/app.js
  • /home/michael/joplin/ElectronClient/index.html
    at Module._resolveFilename (internal/modules/cjs/loader.js:717)
    at Function…/lib/common/reset-search-paths.ts.Module._resolveFilename (reset-search-paths.ts:40)
    at Module._load (internal/modules/cjs/loader.js:622)
    at Module._load (electron/js2c/asar.js:717)
    at Function.Module._load (electron/js2c/asar.js:717)
    at Module.require (internal/modules/cjs/loader.js:775)
    at require (internal/modules/cjs/helpers.js:68)
    at Object. (/home/michael/joplin…e3/lib/sqlite3.js:4)
    at Object. (/home/michael/joplin…/lib/sqlite3.js:209)
    at Module._compile (internal/modules/cjs/loader.js:880)
1 Like

Hi @Tiemichael
Thanks for sharing your issue.

So are you also trying to start the ElectronClient ?

Yes, after ‘npm start’ I see the same picture you posted.

I have ~/joplin/ElectronClient/node_modules/sqlite3/lib/binding/node-v79-linux-arm64/node_sqlite3.node installed, but the folder should be ‘electron-v7.1-linux-arm64

1 Like

@techguybiswa @Tiemichael check this out

Tldr: you’ll most likely need to build you sqlite3 binary from source to get the library used here to use it

Hi @bedwardly-down,

Thanks for the link. I got some hints from it and researched more.
Now my issue is resolved.

I ran the following command:
"npm install electron-rebuild ./node_modules/.bin/electron-rebuild -w sqlite3 -p "

To know more as of how it is working I am linking the reference: https://stackoverflow.com/questions/38716594/electron-app-cant-find-sqlite3-module

@Tiemichael this solution might work for you too!

2 Likes

Glad to hear. I’m currently a volunteer comaintainer for the node-sqlite3 package that Joplin uses as a side project, so figured it might be of use. :wink:

2 Likes

Thank you!
Yes, it’s working for me!

2 Likes

Hey,

It also solved the same problem here! :muscle:

1 Like