-
-
Notifications
You must be signed in to change notification settings - Fork 350
Closed
Labels
Description
Since updating to Node 18.6 SQLTools extension stopped working with SQLite.
When trying to connect to the sqlite database, I get the error 'You need to install "sqlite3@4.2.0" to connect'. Trying to install the driver by clicking "install" reports a successful installation but the problem persists. There doesn't seem to be any errors in the logs from the installation.
Also tried uninstalling SQLTools and SQLite extensions, clearing the caches and reinstalling.
To Reproduce
- Create sqlite connection
- Attempt to connect to database
- Select "Install" from the error message popup
Expected behavior
SQLTools should connect to sqlite database
Desktop
- SQLTools Version: 0.23.0
- SQLTools SQLite: 0.2.0
- VSCode Version: 1.69.2
- OS: MacOS 12.5
- Database version: sqlite3 3.39.0
Metadata
Metadata
Assignees
Labels
Projects
Milestone
Relationships
Development
Select code repository


Activity
gjsjohnmurray commentedon Jul 28, 2022
See also #858
stuartstein777 commentedon Aug 1, 2022
I have the same problem on Ubuntu.
mtxr commentedon Sep 5, 2022
@danielvy can you provide more information? have you checked the extension output to see if it looks like #858 ?
danielvy commentedon Sep 5, 2022
@mtxr
Not sure which additional information to provide.
As I said, there's prompt to install "sqlite3@4.2.0". When proceeding, a terminal opens for a brief moment that attempts to install the driver. The npm command appears to be successful from what I can see (it closes pretty quickly). Then when trying to connect again, it still requires to install "sqlite3@4.2.0".
The only relevant thing I can find in the logs is the SQLTools output:
If you have any specific information you need, let me know and I'll look it up.
gjsjohnmurray commentedon Sep 5, 2022
@danielvy please download the ZIP from the link it #953 (comment) then unzip it and install it into VS Code. One way to install is to drag/drop it onto the Extensions view.
Then let us know if you can connect.
danielvy commentedon Sep 6, 2022
@gjsjohnmurray
Still can't connect.
Now I get a prompt to upgrade to "sqlite3@5.0.10", after selecting "upgrade now" it installs sqlite but next time I try to connect I still get the prompt.
One thing I noticed is that the
npm i sqlite3@5.0.10is being executed in~/Library/Application Support/<project name>, so the sqlite package in installed under~/Library/Application Support/<project name>/node_modules. I assume this is not the intended location and the reason the extension can't find it?gjsjohnmurray commentedon Sep 7, 2022
@danielvy what exactly is the string that you represented above as
<project name>?Through reading source code and testing on Linux I would expect it to be
vscode-sqltools, but maybe on macOS it is something else. And are you seeing it vary depend on what folder you opened in VS Code?danielvy commentedon Sep 7, 2022
My bad, I feel silly. I named my test project "vscode-sqltools" so I just assumed it's where the install path is taken from. The path is indeed
~/Library/Application Support/vscode-sqltools/. Sorry about that.I deleted all relevant directories and reinstalled the extensions. Now there's an error when sqlite3@5.0.10 is compiled from source, but it doesn't seem to be directly caused by the extension. Looks like there's a known issue with node-gyp that fails when the directory contains spaces ("Application Support").
See nodejs/node-gyp#65, nodejs/node-gyp#2556 and nodejs/node-gyp#1038. It's 10 years old, the bug marked as completed but apparently it's still an issue.
gjsjohnmurray commentedon Sep 7, 2022
@danielvy thanks for the extra information. Does your workstation contain Apple silicon (e.g. M1, M2) or is it an Intel one?
cclauss commentedon Sep 8, 2022
nodejs/node-gyp#2556 (comment)
danielvy commentedon Sep 8, 2022
Yes, it's a Macbook Pro with M1 chip.
danielvy commentedon Sep 8, 2022
Even though the installation error is not caused directly by the extension,
vscode-sqltoolsstill reports a successful installation ofsqlite3. The terminal window sometimes closed quickly and it's hard to understand what's going on unless someone digs in thenpmlogs. Maybe the extension can detect and report unsuccessful driver install?Also, the node-gyp bug may or may not be fixed anytime soon. Is there any reasonable workaround? Manually installing
sqlite3someplace else and and copying it to~/Library/Application Support/vscode-sqltools/?cclauss commentedon Sep 8, 2022
Try backslash-space or quotes?
~/Library/Application\ Support/vscode-sqltools/"~/Library/Application Support/vscode-sqltools/"gjsjohnmurray commentedon Sep 9, 2022
@danielvy please try the dev VSIX in the attached zip. It won't solve the problem of sqlite3 failing to build an M1 binary on a path containing spaces, but it should keep the build window open so you can see the command that was run. Then I suggest you run that command (omit the
&& exit(0)bit) in a temp folder whose path doesn't contain spaces. Assuming it succeeds, move the node_modules folder into~/Library/Application Support/vscode-sqltools/Data/and see if this gets SQLTools working with SQLite.sqltools-0.25.0-dev.zip
@cclaus thanks for your suggestion, but it's not clear to me that we're going to be able to fool the sqlite3 package into passing a quoted or escaped path into node-gyp when it needs to build the M1 binary.
Perhaps a better hope is that the https://github.com/TryGhost/node-sqlite3/tree/arm64-test branch might get merged soon and produce a sqlite3 release that contains the M1 binary. @daniellockyer do you have a timescale for this?
mtxr commentedon Sep 9, 2022
Guys, I’m about to help with the SQLite over the weekend. I was able to install it on my m1 here outside of the extension, I haven’t detected though the difference between the extension and the terminal I was using.
possibly workaround would be install somewhere and move, but I’ll try to get a better steps on how to do this.
gjsjohnmurray commentedon Sep 9, 2022
@mtxr glad to hear you've got an m1 to work on. When you installed the sqlite3 package from a terminal was there a space in your path?
danielvy commentedon Sep 9, 2022
I copied the entire folder from
~/Library/Application Support/vscode-sqltoolsto a temp directory, rannpm i sqlite3@5.0.10there, sqlite3 was successfully built and installed on my M1, then copied it all back as is.SQLTools is now able to connect to the database. Will have to do this each time I update node or a new sqlite3 version is required but I can work with this for now.
daniellockyer commentedon Sep 14, 2022
@gjsjohnmurray Hey! 👋🏻
I'd love to merge and release M1 binaries but I'm hitting a blocker that is preventing that. If anyone here has any ideas, I'd be glad to hear them 🙂
gjsjohnmurray commentedon Sep 15, 2022
Today's 0.4.0 release of the SQLTools SQLite driver uses a new release of the sqlite3 package (5.1.1) which should be able to download binaries suitable for macOS on ARM64 hardware. I'm closing this but will reopen if told that it doesn't work.
zrong commentedon Oct 2, 2022
~/Library/Application Support/vscode-sqltools$ npm install sqlite3