vscode-sqltools: Unable to install sqlite3 npm package

Describe the bug

I am unable to install the sqlite3 npm package, because there is a loop of the extension asking to install it.

I am able to install the sqlite3 npm package outside of vscode in an arbitrary directory using npm install sqlite3@4.2.0.

[1610487207492] INFO  (ext): EXECUTING COMMAND => sqltools.selectConnection
[1610487207492] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1610487207492] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1610487207494] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1610487207495] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1610487207496] INFO  (ls): REQUEST RECEIVED => connection/ConnectRequest
[1610487207496] INFO  (ls): Connection instance created for database.
    ns: "conn-manager"
[1610487207502] ERROR (ls): Connecting error: {"code":1000,"data":{"notification":"Core/missingModule","dontNotify":true,"args":{"conn":{"previewLimit":50,"driver":"SQLite","database":"${workspaceFolder:project}/data/database.sqlite","name":"database","isActive":false,"isConnected":false,"id":"database|SQLite||${workspaceFolder:project}\\data\\database:sqlite"},"action":"install","deps":[{"type":"package","name":"sqlite3","version":"4.2.0"}]}}}
    ns: "conn-manager"
[1610487207505] INFO  (ext): Connection explorer changed. Will be updated.
    ns: "conn-man:explorer"
[1610487207507] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1610487207507] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1610487209186] INFO  (ls): REQUEST RECEIVED => DependencyInstaller/install
[1610487209186] INFO  (ls): Will install sqlite3 package
    ns: "dep-man"

up to date, audited 69 packages in 2s

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[1610487211461] INFO  (ls): Finished sqlite3 script
    ns: "dep-man"
[1610487211461] INFO  (ls): Finished installing deps
    ns: "dep-man"
[1610487212553] INFO  (ext): EXECUTING COMMAND => sqltools.selectConnection
[1610487212553] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1610487212553] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1610487212554] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1610487212554] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1610487212555] INFO  (ls): REQUEST RECEIVED => connection/ConnectRequest
[1610487212555] INFO  (ls): Connection instance created for database.
    ns: "conn-manager"
[1610487212560] ERROR (ls): Connecting error: {"code":1000,"data":{"notification":"Core/missingModule","dontNotify":true,"args":{"conn":{"previewLimit":50,"driver":"SQLite","database":"${workspaceFolder:project}/data/database.sqlite","name":"database","isActive":false,"isConnected":false,"id":"database|SQLite||${workspaceFolder:project}\\data\\database:sqlite"},"action":"install","deps":[{"type":"package","name":"sqlite3","version":"4.2.0"}]}}}
    ns: "conn-manager"
[1610487212561] INFO  (ext): Connection explorer changed. Will be updated.
    ns: "conn-man:explorer"
[1610487212575] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1610487212575] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest

To Reproduce Steps to reproduce the behavior:

  1. Install sqltools and sqlite3 driver extensions
  2. Connect to sqlite database
  3. Message: “You need to install “sqlite3@4.2.0” to connect to <database>.”. Click “Install Now”
  4. Message: ““sqlite3@4.2.0” installed! Go ahead and connect!”. Click “Connect to <database>”.
  5. goto 3

Expected behavior

Installs sqlite3 package and opens database

Screenshots N/A

Desktop (please complete the following information):

  • SQLTools Version 0.23.0
  • VSCode Version: 1.52.1
  • OS: Windows
  • Driver:
    • PostgreSQL/Redshift
    • MySQL/MariaDB
    • MSSQL/Azure
    • SQLite 0.2.0
    • Other? Which…
  • Database version: sqlite

Additional context N/A

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 18 (2 by maintainers)

Commits related to this issue

Most upvoted comments

As suggested by @magic-lantern, I’ve fixed this by deleting the “node_modules” and “package-lock.json” from C:\Users\<username>\AppData\Local\vscode-sqltools\Data

However, I don’t get any tables, which is a separate issue.

Here are the paths:

macOS: ~/Library/Application Support/vscode-sqltools Windows: %LOCALAPPDATA%\vscode-sqltools\Data (for example, C:\Users\USERNAME\AppData\Local\vscode-sqltools\Data) Linux: ~/.local/share/vscode-sqltools (or $XDG_DATA_HOME/vscode-sqltools)

This can vary based on each machine setup, I hope making the path explicity here can help you guys fix/debug it so we can find a better solution for this problem.

I’m doing an improvement on dependencies installer code to use vscode terminal instead of spawning a shell to install deps. This will fix issues for most of the setups

My installation of sqltools was working great until about a week ago when I updated my npm/node installation. After that, sqltools sqlite driver stopped working with the error as described in this issue - an infinite installation loop.

I’m on macOS so my steps will be different than others, but I found this previous issue that gave me some guidance - see #638

My fix was to remove the installed npm files for this extension and re-install.

cd ~/Library/Application\ Support/vscode-sqltools/
rm ./package-lock.json
rm -rf ./node_modules
npm i

npm -i installed the npm module sqlite3@4.2.0 and all required dependencies. I then restarted VSCode and everything worked fine. For people on Windows, I would guess that the vscode-sqltools directory would be located at something like C:\Users\{Your User Name}\AppData\vscode-sqltools .

If any one can confirm or provide the correct OS specific path, please update this issue!