mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.48k stars 296 forks source link

Sqlite Connection not working #1008

Closed RaptorX closed 1 year ago

RaptorX commented 1 year ago

Describe the bug Tried to create a new Sqlite connection but I get a warning saying I should use sqltools.useNodeRuntime after I follow the instructions then I get errors and cant create a connection.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'connections'

  2. Click on 'add connection'

  3. Select Sqlite

  4. See error image

  5. After following instructions and retrying I get the following error: image

and this is the Window Log:

[2022-10-13 10:47:46.074] [renderer1] [error] command 'sqltools.openAddConnectionScreen' not found: Error: command 'sqltools.openAddConnectionScreen' not found
    at S._tryExecuteCommand (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1715:3532)
    at S.executeCommand (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1715:3414)
    at async i.open (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:608:47397)
    at async c.open (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:608:49173)

Expected behavior A new connection window should be shown

Desktop (please complete the following information):

Additional context Im new to the tool and this is the first time setting it up

gjsjohnmurray commented 1 year ago

My guess is you only have the Windows PowerShell version that ships with Windows.

Please go to https://aka.ms/PSWindows and follow the instructions about installing PS 7. Then try again.

RaptorX commented 1 year ago

My guess is you only have the Windows PowerShell version that ships with Windows.

Please go to https://aka.ms/PSWindows and follow the instructions about installing PS 7. Then try again.

You are correct, didnt know I needed PS 7. probably didnt see it in the documentation.

image

Will update and try again.

RaptorX commented 1 year ago

That didnt help.

installed latest powershell. image

Getting the same error.

[2022-10-14 15:16:25.937] [renderer1] [error] command 'sqltools.openAddConnectionScreen' not found: Error: command 'sqltools.openAddConnectionScreen' not found
    at S._tryExecuteCommand (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1715:3532)
    at S.executeCommand (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1715:3414)
    at async i.open (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:608:47397)
    at async c.open (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:608:49173)
gjsjohnmurray commented 1 year ago

Does a SQLTools channel appear in the dropdown on the OUTPUT tab of the VS Code's Panel? If yes, what does it contain?

On the TERMINAL tab of the Panel have any extra terminals opened?

I see that you have a System Setup installation of VS Code. I haven't tried that type. Are you able to install VS Code as User Setup (the default mode) and re-test?

oaahmad commented 1 year ago

I had the exact same issue (installed the extension for the first time, went through the exact same steps, got the exact same errors/notifications). It turned out I just did not have node installed on my system. Once I installed node, those errors went away. I see this user does have node installed, but I wanted to leave this comment just in case it provides some hint as to what is happening. Hopefully it helps in some way.

RaptorX commented 1 year ago

Does a SQLTools channel appear in the dropdown on the OUTPUT tab of the VS Code's Panel? If yes, what does it contain?

On the TERMINAL tab of the Panel have any extra terminals opened?

[1666032312396] INFO  (ext): SQLTools is starting
[1666032312445] INFO  (ext): initializing language client...
[1666032312446] INFO  (ext): Detecting node path (if this stalls check Terminal view for the stuck session and kill it)...
    ns: "lc"

I see that you have a System Setup installation of VS Code. I haven't tried that type. Are you able to install VS Code as User Setup (the default mode) and re-test?

I can give it a try later on a virtual machine.

I had the exact same issue (installed the extension for the first time, went through the exact same steps, got the exact same errors/notifications). It turned out I just did not have node installed on my system. Once I installed node, those errors went away. I see this user does have node installed, but I wanted to leave this comment just in case it provides some hint as to what is happening. Hopefully it helps in some way.

I think i have node installed:

image

Not sure if I need to do something specific with VSCode though.

gjsjohnmurray commented 1 year ago

Yo should be able to bypass the failing autodetect by instead setting your sqltools.useNodeRuntime property to point to your Node executable. For example mine is:

    "sqltools.useNodeRuntime": "C:\\Program Files\\nodejs\\node.exe",

But I'm puzzled that your screenshot shows Node.js as an App. Here's what mine shows:

image

I am using Windows 11, and I think you are on Windows 10. Don't know if that explains the difference. Where did you Install Node from?

RaptorX commented 1 year ago

Yo should be able to bypass the failing autodetect by instead setting your sqltools.useNodeRuntime property to point to your Node executable. For example mine is:

  "sqltools.useNodeRuntime": "C:\\Program Files\\nodejs\\node.exe",

Perfect, will try that later.

EDIT: This happens to be the path on my PC as well...

But I'm puzzled that your screenshot shows Node.js as an App. Here's what mine shows [as command] I am using Windows 11, and I think you are on Windows 10. Don't know if that explains the difference. Where did you Install Node from?

Some time ago (prior to knowing about this extension) I was messing with nodejs... downloaded it from their site and installed it using their official installer.

Yes I am using Win10.

RaptorX commented 1 year ago

I think i found the issue.

It seems like SQLTools hangs on start.

[1666392733619] INFO  (ext): SQLTools is starting
[1666392733622] INFO  (ext): initializing language client...
[1666392733622] INFO  (ext): Detecting node path (if this stalls check Terminal view for the stuck session and kill it)...
    ns: "lc"

After killing the terminal session it now shows the connection panel.

  "sqltools.useNodeRuntime": "C:\\Program Files\\nodejs\\node.exe",

This did not help addressing the issue which is weird because I would assume that explicitly setting the nodeRuntime path would prevent the extension from detecting the path automatically.

after killing the terminal I can see this in the log:

[1666393218546] INFO  (ls): SQLTools Server started!
===============================
Using node runtime?: yes
ExecPath: C:\Program Files\nodejs\node.exe v16.15.1
===============================

I would assume that the extension is not removing the autodetect feature correctly when a path has been setup.

After killing the terminal and installing the additional file as described here I was able to perform a connection and everything is working as intended.

gjsjohnmurray commented 1 year ago

Today's 0.26.0 release should make the autodetect mechanism work with other Windows command shells. Closing this.