There was an error initializing DB: "SQLite package has not been found installed. Try to install it: npm install sqlite3

Running on 0.169.0 perfectly.
Using Lightsail (AWS)
PM2
Caddyserver
Have setup user management succesfully, ENV variables for SMTP and so forth. These get loaded when I stop or start the server because of the pm2 startup and pm2 save commands.
Also pointed at my domain, SSL ok and everything ok.

Installed globally with npm, with root. sudo su, on Debian instance

I have been able to update several times now using:
pm2 stop n8n
npm install -g [email protected]
pm2 restart n8n

The last time a couple days ago, it went to 0.172.0 (I think) and then the pm2 log console started looping on this message, taking CPU to 100% and I had to rescue the older version 0.169.0 from a snapshop and mounting on a new instance.

Error:
There was an error initializing DB: "SQLite package has not been found installed. Try to install it: npm install sqlite3

Any clue on what happened? I dont want to go to the whole process of creating a new instance and loading the saved snapshop. It does involve a bit of work.

Can you see anything released on 170,171,171.1 or 172 that breaks this?

Thanks for any support somebody can give me

Andres

Hey @pradilla,

That looks like npm has not installed sqlite3 I suspect the sqlite3 node package has been updated and for some reason it is failing.

Do you have the full output of the install log? While this isn’t directly an n8n issue I am sure we can work out what needs to happen to fix it.

Thanks @Jon !! Im far from being an expert, just managed to install it with pm2 from a youtube tutorial. So please guide me a bit on where and how to get my hands on that log. I can run the update process and send over the logs from the cli, would this be enough?

Hey @pradilla,

I think when it fails npm normally says you can get a full log from a path and it gives you the path to check.

Below the cli logs after update. Any comments are more than welcome.
Maybe something was not ok with release 171 or 172.
This one worked same as before!!!
Great!
Thanks anyways =)

[email protected]:/home/admin# npm install -g [email protected]
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to latest, [email protected] or [email protected]! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

added 64 packages, removed 39 packages, changed 921 packages, and audited 986 packages in 1m

88 packages are looking for funding
  run `npm fund` for details

8 high severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 8.3.0 -> 8.7.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.7.0
npm notice Run npm install -g [email protected] to update!
npm notice
[email protected]:/home/admin#
1 Like

So I don’t think it working or not working is related to anything we have done and it is more down to NPM being able to grab the package. As it didn’t error though it makes it a bit tricky to try and work out what happened.

For now I guess we can mark this one as solved and if it happens again we can try and get hold of that log.

Agree we can close as solved, thanks @Jon.
PD. Funny thing is after it failed I tried to roll back, install same version as before, reinstall, uninstall, etc. nothing worked.
One thing I did differently today is the following.
When the update failed 6 days ago, It had like 3500 execution history. When I try to delete all at once it will not work, it stalls and errors. So I created a workflow to clean executions on a daily basis (delete them on a 10 by 10 loop). So every morning I have a clean slate on executions.
And the update done today was done while the execution database was almost 0. Maybe this helped, who knows.

1 Like

Hi guys,

I’m still having this issue. Wanted to upgrade from 1.330 to 1.173, and now n8n says: "There was an error initializing DB: “SQLite package has not been found installed. Try to install it: npm install sqlite3 --save”

Actually stressing out, because there were some critical workflows in there :sweat_smile:

I tried installing sqlite3, globally and locally. Nothing worked. Node-pre-gyp did fail installing at first, but then I changed the path: export npm_config_node_gyp=/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js, but that didn’t work either.

Hey @Jasper_van_Doorn,

Welcome to the community :metal:

It looks like the sqlite package is being a pain as well, Do you have the log output so I can check the errors? While it isn’t our package or something we really have control of we can try and work out what is going on to save you a headache.

The output of npm install -g sqlite3 could be enough as that is the part that is failing.

@Jon

 npm install -g sqlite3

> [email protected] install /home/admin/.npm-packages/lib/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

[sqlite3] Success: "/home/admin/.npm-packages/lib/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node" is installed via remote
+ [email protected]
updated 1 package in 4.761s
n8n
Initializing n8n process
There was an error initializing DB: "SQLite package has not been found installed. Try to install it: npm install sqlite3 --save"

Stopping n8n...

For what I see now, is that these paths: export npm_config_node_gyp=/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js

and: “/home/admin/.npm-packages/lib/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node”

Are different. Do I need another npm_config_node_gyp variable?

node-pre-gyp install --fallback-to-build
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: prikr-workflows package.json is not node-pre-gyp ready:
node-pre-gyp ERR! stack package.json must declare these properties:
node-pre-gyp ERR! stack binary.module_name
node-pre-gyp ERR! stack binary.module_path
node-pre-gyp ERR! stack binary.host
node-pre-gyp ERR! stack     at validate_config (/home/admin/.npm-packages/lib/node_modules/node-pre-gyp/lib/util/versioning.js:220:15)
node-pre-gyp ERR! stack     at Object.module.exports.evaluate (/home/admin/.npm-packages/lib/node_modules/node-pre-gyp/lib/util/versioning.js:279:5)
node-pre-gyp ERR! stack     at install (/home/admin/.npm-packages/lib/node_modules/node-pre-gyp/lib/install.js:241:31)
node-pre-gyp ERR! stack     at Object.self.commands.<computed> [as install] (/home/admin/.npm-packages/lib/node_modules/node-pre-gyp/lib/node-pre-gyp.js:52:37)
node-pre-gyp ERR! stack     at run (/home/admin/.npm-packages/lib/node_modules/node-pre-gyp/bin/node-pre-gyp:82:30)
node-pre-gyp ERR! stack     at Object.<anonymous> (/home/admin/.npm-packages/lib/node_modules/node-pre-gyp/bin/node-pre-gyp:134:1)
node-pre-gyp ERR! stack     at Module._compile (internal/modules/cjs/loader.js:1085:14)
node-pre-gyp ERR! stack     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
node-pre-gyp ERR! stack     at Module.load (internal/modules/cjs/loader.js:950:32)
node-pre-gyp ERR! stack     at Function.Module._load (internal/modules/cjs/loader.js:790:14)
node-pre-gyp ERR! System Linux 3.10.0-962.3.2.lve1.5.56.el7.x86_64
node-pre-gyp ERR! command "/usr/bin/node" "/home/admin/.npm-packages/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/admin/domains/prikr.space/public_html/workflows
node-pre-gyp ERR! node -v v14.17.2
node-pre-gyp ERR! node-pre-gyp -v v0.17.0
node-pre-gyp ERR! not ok
prikr-workflows package.json is not node-pre-gyp ready:
package.json must declare these properties:
binary.module_name
binary.module_path
binary.host

[[email protected] workflows]$ export npm_config_node_gyp=$(which node-gyp)
[[email protected] workflows]$ npm install && n8n

> [email protected] install /home/admin/domains/prikr.space/public_html/workflows/node_modules/cpu-features
> node buildcheck.js > buildcheck.gypi && node-gyp rebuild

gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - executable path is "/usr/bin/python"
gyp ERR! find Python - version is "2.7.5"
gyp ERR! find Python - version is 2.7.5 - should be >=3.6.0
gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/home/admin/.npm-packages/lib/node_modules/node-gyp/lib/find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (/home/admin/.npm-packages/lib/node_modules/node-gyp/lib/find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/home/admin/.npm-packages/lib/node_modules/node-gyp/lib/find-python.js:266:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/home/admin/.npm-packages/lib/node_modules/node-gyp/lib/find-python.js:297:7)
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:7)
gyp ERR! stack     at ChildProcess.emit (events.js:375:28)
gyp ERR! stack     at maybeClose (internal/child_process.js:1055:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:441:11)
gyp ERR! stack     at Socket.emit (events.js:375:28)
gyp ERR! stack     at Pipe.<anonymous> (net.js:675:12)
gyp ERR! System Linux 3.10.0-962.3.2.lve1.5.56.el7.x86_64
gyp ERR! command "/usr/bin/node" "/home/admin/.npm-packages/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/admin/domains/prikr.space/public_html/workflows/node_modules/cpu-features
gyp ERR! node -v v14.17.2
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of @fortawesome/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @fortawesome/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @fortawesome/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/cpu-features):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node buildcheck.js > buildcheck.gypi && node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

audited 956 packages in 8.318s

87 packages are looking for funding
  run `npm fund` for details

found 4 high severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
Initializing n8n process
There was an error initializing DB: "SQLite package has not been found installed. Try to install it: npm install sqlite3 --save"

Stopping n8n...
[[email protected] workflows]$ node -v
v14.17.2
[[email protected] workflows]$ node-gryp -v
-bash: node-gryp: command not found
[[email protected] workflows]$ node-pre-gyp -v
v0.17.0
[[email protected] workflows]$ node-gyp -v
v9.0.0
[[email protected] workflows]$ npm -v
6.14.13

Alright that is a massive help. So one of the things we did recently was update to Node 16 so it would be worth making that update, It also looks like sqlite3 is failing to build because you are using an old version of Python so installing python3 should in theory solve the issue.

Oddly enough Python issues was what first got me into using n8n but I took the docker route so I didn’t have to worry about it on the host OS. Anyway… pop on python 3 and you should be sorted.

Hi @jon on thanks for the reply.
But if i want to revert back to version 1.330 it also states the sqlite3 database error?

Hey @Jasper_van_Doorn,

That could be because the sqlite3 package has updated it can be a bit tricky. Out of interest what is 1.330? We are only on 0.173 are you moving from Desktop to npm?

I suspect if you get the same error you will need to do the same thing and install python 3, You can run 2 and 3 at the same time so it shouldn’t break anything.

@jon sorry, i ment 0.130

1 Like