I am trying to deploy this full stack web application that includes SQLite3, Express, React and NodeJS, however I am getting the following error:
SQLITE_CANTOPEN: unable to open database file
I have tried many different solutions but nothing seems to work. I really appreciate your help with this.
Since you don’t mentioned what solutions you have tried, I might be giving you an advice you have already explored, but have you tried path.resolve to get an absolute path for your db.
Also, on another note. I’m not sure why you have the replace function around that path. Its replacing a string that isn’t there.
Another note: Is this an electron app?
Hello Bergur, thank you so much for your help.
Let me give you a summary and some context. So this is one of my first projects as a software developer. I’m new in the industry and this is one of my flagship projects to include on my portfolio. It is not an electron app but I installed the module because it was one of the potential solutions I found. So this is what I have done:
First I was getting this error. I had the folder /napi-v6-win32-glibc-x64 but there was no such folder /napi-v6-linux-glibc-x64 so I created a folder and found online the node_sqlite.node file for linux. Apparently it worked.
I installed electron-rebuild and added the following:
Then I removed that code and wrapped the db opening within a promise
Well I have made other minor changes but nothing significant. I have installed and uninstalled modules that I have read might help but nothing has changed. I have tried installing email@example.com but it didn’t make any difference.
Thank you so much in advance for taking the time to help me.
Does the SQLite file exist on Render?
In addition, if using SQLite, you’ll need a Disk. Render runtime instance filesystems are ephemeral, meaning anything written to the instance filesystem at runtime will be lost when it next restarts (e.g. next deploy). If you need persisted files (user uploads, generated files, etc.) you’d need to add a disk, with a SQLite database created within the mount path you specify.
Hello @al_ps, yes, the file is on the repository.
Thank you so much for the information, I will read more about Disk. I really appreciate your help.
Hello @al_ps, I was exploring the alternative of including a Disk, but I realized that’s not a free service. To be honest, this is just a school project and all I want is to deploy it for potential employers. I want this to be part of my portfolio. Is there any way I can deploy the project using the free version???