Open coltossoff opened 6 months ago
This worked for me
npm install sqlite3
ls node_modules/sqlite3 # folder `build` does not exist, hence the error messages about missing bindings
cd node_modules/sqlite3
npm run rebuild
ls build # now exists 🥳
cd ../..
In my case when I run vscode extension development host, although node_modules/sqlite3/build/Release/*.node exists, error occured like this: Could not locate the bindings file. Tried: → /home/USERNAME/project/build/node_sqlite3.node → /home/USERNAME/project/build/Debug/node_sqlite3.node → ...
I just copy node_sqlite3.node to build, and it is solved. Since webpack is used to pack vscode extension, so I use copy-webpack-plugin to do the copy job. Snippet like below:
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: path.resolve(__dirname, "node_modules/sqlite3/build/Release/node_sqlite3.node"), to: path.resolve(__dirname, "build/node_sqlite3.node") }
]
})
],
Issue Summary
I'm trying to add a Sqlite Db to the Express server part of my Angular SSR project. I installed
sqlite3
and@types/sqlite3
which seemed to work. But, when I trynew Database('./sqlite.db')
I get the below runtime errors after compiling. I'm not clear what I haven't installed or configured correctly. The application is running properly as soon as I remove this line.tsconfig.json
package.json
server.ts
Relevant logs or output
Version
5.1.7
Node.js Version
22.0.0
How did you install the library?
Windows 11, Angular SSR 17.3.6, Express 4.18.2