Teebow Glitcher
Teebow Glitcher

Reputation: 31

Cannot find module '/home/container/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node'

Everything's running perfectly throught cmd on my pc but when i host it on my host servers i have this error:

`:/home/container$ npm start knexfile.js Starting Modmail 3.3.0 on Node.js 12.19.1 (x64) Loading configuration from config.ini... Configuration ok! Using an SQLite database: /home/container/db/data.sqlite Knex: run $ npm install sqlite3 --save Cannot find module '/home/container/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node' Require stack:

Upvotes: 3

Views: 5199

Answers (3)

Akaisteph7
Akaisteph7

Reputation: 6506

What seems to have resolved it for us was running npm rebuild.

See this GitHub Issue page for a similar issue.

Upvotes: 0

Akshay Jain
Akshay Jain

Reputation: 31

RESOLVED: I had a yarn.locker file in my project. I deleted that file and rebuild the project and it worked for me. Steps:

  1. Delete yarn.locker
  2. docker build
  3. docker run

The error may be because of previous downloaded dependencies which are not compatible.

Upvotes: 0

Alexander Schmitt
Alexander Schmitt

Reputation: 41

SQLite3 needs a library which is specific for the architecture of your target system. If you install the npm package, it tries to build this library from its source code, "live" on the target machine. This may fail, if the target system does not have the necessary C compiler and build tools installed.

If you try to upload your node_modules folder to the target machine, this does only work, if dev and prod machines have the same architecture. So uploading the modules from your dev machine (Windows) to the target machine (Linux) will not work in your scenario.

One solution would be to install all necessary build tools on the target machine, delete the node_modules/sqlite3 folder and retry package installation with npm install.

A workaround would be to compile the necessary Linux library on a different Linux machine or an equivalent docker container and then upload it to the target machine.

The file for Linux AMD64 architecture can be found in this folder after a successful npm install: node_modules/sqlite3/lib/binding/napi-v3-linux-x64

If none of the above is an option for you, you will find a version for [email protected] which I compiled right now at http://hosting134516.a2e37.netcup.net/napi-v3-linux-x64/node_sqlite3.node but please observe, that this may only work with version 5.0.2 of the SQLite3.

Greeting, Alex

Upvotes: 3

Related Questions