importing sqlite3 fails in dev mode
See original GitHub issueDescribe the bug
A recent update to sveltekit broke the usage of sqlite3 in server-side code.
When using npm’s sqlite3 module in server-side code and running the code in development mode, the import fails with
Cannot find module 'node_modules/sqlite3/package.json' imported from 'node_modules/node-pre-gyp/lib/pre-binding.js'
at viteResolve (node_modules/vite/dist/node/chunks/dep-4a9cff06.js:67808:25)
Reproduction
use sqlite3 in a svelte hook, and run the code with svelte-kit dev
Reproducible in https://github.com/lovasoa/sanipasse/tree/5f4a3d5177c88462b2bee2c029eeb7534155cdb2
Logs
Error: Cannot find module '/home/olojkine/dev/sanipasse/node_modules/sqlite3/package.json' imported from '/home/olojkine/dev/sanipasse/node_modules/node-pre-gyp/lib/pre-binding.js'
at viteResolve (/home/olojkine/dev/sanipasse/node_modules/vite/dist/node/chunks/dep-4a9cff06.js:67808:25)
at Function._resolveFilename (/home/olojkine/dev/sanipasse/node_modules/vite/dist/node/chunks/dep-4a9cff06.js:67822:20)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.exports.find (/home/olojkine/dev/sanipasse/node_modules/node-pre-gyp/lib/pre-binding.js:20:23)
at Object.<anonymous> (/home/olojkine/dev/sanipasse/node_modules/sqlite3/lib/sqlite3-binding.js:3:27)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
System Info
System:
OS: Linux 5.15 Fedora Linux 35 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 1.18 GB / 15.28 GB
Container: Yes
Shell: 5.1.8 - /bin/bash
Binaries:
Node: 16.13.0 - /usr/bin/node
Yarn: 1.22.10 - /usr/bin/yarn
npm: 8.1.0 - /usr/bin/npm
Browsers:
Firefox: 95.0
npmPackages:
@sveltejs/adapter-node: next => 1.0.0-next.56
@sveltejs/adapter-static: next => 1.0.0-next.22
@sveltejs/kit: next => 1.0.0-next.202
svelte: ^3.38.3 => 3.44.3
Severity
blocking an upgrade
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:18 (13 by maintainers)
Top Results From Across the Web
Syntax Error when trying to import csv using sqlite3
I am trying to import a csv file into my jupyter notebook using sqlite3 but I keep getting a syntax error. I have...
Read more >Import sqlite issue in Slicelet - 3D Slicer Community
when i try to import sqlite from the slicelet, i have an import error (that does not appear when launch the soft outside...
Read more >SQLiteDatabase | Android Developers
In FULL sync mode the SQLite database engine will use the xSync method of the VFS to ensure that all content is safely...
Read more >C/C++ Interface For SQLite Version 3
A VFS that fails to zero-fill short reads might seem to work. However, failure to zero-fill short reads will eventually lead to database...
Read more >How To Use an SQLite Database in a Flask Application
import sqlite3 from flask import Flask, render_template app ... to development to run the application in development mode and get access to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing this as vitejs/vite#6488 has been merged. Once that is released, you can update SvelteKit’s Vite version to that new version.
I’ve sent a fix at https://github.com/vitejs/vite/pull/6488