mtxr / vscode-sqltools

Database management for VSCode

Home Page:https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting error detecting node runtime

giggio opened this issue · comments

Describe the bug
I have read through the issues and can't find an answer. I don't know what is happening, but I'm getting the message:

Check Terminal view for an erroring 'detect node runtime' session. Capture details for investigation, then kill the terminal to continue SQLTools extension startup. Change the 'sqltools.useNodeRuntime' setting to disable runtime detection.

Every time code opens.

Logs for sqltools show:

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

This takes about 5 seconds. The terminal shows:

node -e 'require("fs").writeFileSync("/home/user/.local/share/vscode-sqltools/.node-runtime", process.execPath)' && exit 0                                                                                     

~/p/sql ❯ 

It seems that the script to set the path at /home/user/.local/share/vscode-sqltools/.node-runtime worked, the file is written with the path to node.
After furter investigating, the file was already there. It is not being recreated. See comment: #1283 (comment)

When I close the terminal the extension then works. I get a notification:

Node runtime auto-detected. Using /home/user/.n/bin/node.

Logs also show it:

[1707959947965] INFO  (ext): Node runtime auto-detected. Using /home/giggio/.n/bin/node.
    ns: "lc"
[1707959947970] INFO  (ext): Registering client for languages [{"scheme":"sqltools"},{"language":"sql","scheme":"untitled"},{"language":"sql","scheme":"file"},{"language":"sql","scheme":"sqltools"}]
    ns: "lc"

(log continues after this)

To Reproduce
Steps to reproduce the behavior:

  1. Open Code
  2. See the described behavior

Expected behavior
No error.

Screenshots
N/A

Desktop (please complete the following information):

  • SQLTools Version 0.5.0
  • VS Code Version: `1.86.1
  • OS: Linux (on WSL)
  • Driver:
    • PostgreSQL/Redshift
    • MySQL/MariaDB
    • MSSQL/Azure
    • SQLite
    • Other? Which...
  • Database version: [PostgreSQL 16.2, SQLite 3]

Additional context
It seems to me that the problem is with the terminal, that is not closing.

When using the extension on Windows (same computer, same vscode, as this problem is in WSL) it works.

When that stuck terminal appears, does it close if you enter the following command at its prompt?

exit 0

If it does, please repeat the test but this time enter:

date && exit 0

When that stuck terminal appears, does it close if you enter the following command at its prompt?

exit 0

If it does, please repeat the test but this time enter:

date && exit 0

@gjsjohnmurray In both cases the terminal closes and the process continues as I described, as if I had closed the terminal by clicking on the trash icon.

This is bash:
image

I notice that it seems that scripts are NOT running.
I just noticed a similar behavior, I tried to open a sqlite file, it asked me to install the npm module sqlite. I agreed, it opened a terminal, and exited. The module was not installed.

image

These are the logs:

[1708123705523] ERROR (ext): ERROR: Failed to install dependencies for SQLite: failed to install, 'failed to install'
    ns: "error-handler"
[1708123709001] INFO  (ext): EXECUTING COMMAND => sqltools.showOutputChannel

After closing the terminal, it was still not working, so it asked again to install, this time I inspected the environment:

image

Then, after closing the terminal, everything worked.

I don't know why that command is failing.

Ok, I investigated it a little further.
I deleted the ~/.local/share/vscode-sqltools/.node-runtime file. It is NOT being recreated. So this is just like the npm install issue above, the command is not actually running.

The weird thing about this detail is the the extension works fine without the file. After I close the terminal it works just fine and I can open sqlite databases.