Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: VSCode extension fails to find node or tsp-server in PATH #3481

Closed
4 tasks done
JanStevens opened this issue May 30, 2024 · 5 comments
Closed
4 tasks done

[Bug]: VSCode extension fails to find node or tsp-server in PATH #3481

JanStevens opened this issue May 30, 2024 · 5 comments
Assignees
Labels
bug Something isn't working ide Issues for VS, VSCode, Monaco, etc. triaged:core
Milestone

Comments

@JanStevens
Copy link

Describe the bug

Hi,

I'm using fish shell with mise. When installing the VSCode extension I immediately receive the following error:

[Error - 12:53:10] TypeSpec client: couldn't create connection to server.
Launching server using command node failed. Error: spawn node ENOENT
[Error - 12:53:10] TypeSpec server executable was not found: 'node' is not found. Make sure either:
 - TypeSpec is installed locally at the root of this workspace ("/Users/dev/api-oas") or in a parent directory.
 - TypeSpec is installed globally with `npm install -g @typespec/compiler'.
 - TypeSpec server path is configured with https://github.com/microsoft/typespec#installing-vs-code-extension.

While opening a terminal (in Fish shell) I can see node and tsp-server correctly resolve

~> which node
/Users/dev/.local/share/mise/installs/node/20/bin/node

~> which tsp-server
/Users/dev/.local/share/mise/installs/node/20/bin/tsp-server 

I don't have this issue with any other vs code extension. I did try to set the typespec.tsp-server.path explicitly but it still fails to find node

Reproduction

  1. Install fish shell (not sure if relevant)
  2. Install mise & setup shims integration for IDE
  3. Install node v20 mise install node@20
  4. Install globally typespec npm i -g @typespec/compiler
  5. Install / Open VS Code in a typespec project with the extension installed

Checklist

@JanStevens JanStevens added the bug Something isn't working label May 30, 2024
@RodgeFu RodgeFu added ide Issues for VS, VSCode, Monaco, etc. and removed needs-area labels Jun 1, 2024
@markcowl markcowl added this to the Backlog milestone Jun 3, 2024
@timotheeguerin
Copy link
Member

Logic playwright extension uses for finding node instead of just relying on node spawn to work https://github.com/microsoft/playwright-vscode/blob/2eef642e466bd6d216082571f07434a6a7653bcb/src/utils.ts#L144

@RodgeFu
Copy link
Contributor

RodgeFu commented Jun 6, 2024

@JanStevens , I tried to prepare the environment with the steps above but can't repro the issue. From the log, it's because the node can't be found properly, could you help to check whether 'node' can be found from vscode properly? or is there any other special things in your env that may cause vscode can't find 'node'? thanks.
Image

@JanStevens
Copy link
Author

@RodgeFu Hi, I noticed that everything works if you start VSCode with code . in the typespec directory.

When you then close VSCode and open the project from the VSCode menu it does not work anymore. In the terminal view from VSCode node and typespec are always resolved correctly

@RodgeFu
Copy link
Contributor

RodgeFu commented Jun 7, 2024

@JanStevens , do you mean it doesn't work when you start vscode outside shell? could you double check whether you have set the default shell and shims properly? i.e. I can repro the issue when i removed the call to #eval "$(mise activate bash --shims)" in my ~/.profile, which I think is because the mise shims directory is not added to PATH properly, then vscode extension can't find the node. thanks.

@RodgeFu
Copy link
Contributor

RodgeFu commented Jun 13, 2024

Close as this looks like an environment issue. Feel free to reopen if you get more insights about the repro env. thanks.

@RodgeFu RodgeFu closed this as completed Jun 13, 2024
@RodgeFu RodgeFu self-assigned this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ide Issues for VS, VSCode, Monaco, etc. triaged:core
Projects
None yet
Development

No branches or pull requests

4 participants