Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Raspberry Pi 4: Error: Cannot find module 'sqlite3'

Status of sqlite3 installation on my Raspberry Pi 4 B when queried from the terminal:

pi@raspberrypi:~ $ sqlite3 --version
3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0alt1
pi@raspberrypi:~ $ sqlite3
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> 

For me it is confirmation that installation is complete. Also, I did not do any thing like creating a table or etc. I just installed it. Now I am trying to access it.

My code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

const sqlite3 = require('sqlite3').verbose();

Response:

internal/modules/cjs/loader.js:638
    throw err;
    ^
Error: Cannot find module 'sqlite3'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

Don’t know why it says cannot find sqlite3 when terminal clearly shows its installation and ability to access sqlite3?

>Solution :

The binary executable named sqlite3 and the Node.js module named sqlite3 are not the same thing.

You need to install the Node.js module to use the Node.js module.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading