SQLite package has not been found installed. Try to install it: npm install sqlite3 --save

Hi, I have installed n8n and sqlite3 via npm:

npm install -g n8n sqlite3

But I keep getting this error. I also did npm install sqlite3 --save and it didnt work either. Any help appreciated! Thanks!

Hi @timtestpat Welcome!
For now lets try the basic fix, which will be for now is to rebuild the sqlite3 bindings, so for that run this command inside your n8n directory:
cd /usr/local/lib/node_modules/n8n && npm rebuild sqlite3

See this:

Hi, thanks but I get the same error with that.

I noticed that npm install -g n8n installed n8n to:

~/.npm-global/n8n

and sudo install -g n8n installed it to /usr/local/lib/node_modules/n8n

@timtestpat i think you might have not ran that command where n8n is installed, and this problem occurs only when the sqlite3 build was done in a different folder, so i think if you can than give it another try and make sure you run the command where n8n is installed:
cd ~/.npm-global/lib/node_modules/n8n && npm rebuild sqlite3

In case you have done the exact same and still it causes error, lets try a different approach, with running that command with a sudo like:
sudo npm rebuild sqlite3 --prefix /usr/local/lib/node_modules/n8n
And although i would say that this does not cause much problem until unless we try to change a bit of stuff with it, and for that change i think DOCKER is a more suitable environment. So for now give this a shot and let me know

Thanks Anshul. I think I have some issues with npm (the one being from my distro) and paths. I will investigate and report back

@timtestpat i think you should remove everything, and once that is done, install n8n with simple npm install -g n8n and that is it remove that sqlite3 thing and everything should be fine.

Hi again. I solved it by removing nodejs and npm as installed by my package manager, and used the following

I installed nvm:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install node
nvm alias default node
npm install -g n8n

and it worked!

Thank you for your help though :slight_smile: