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

NVM support / Improve error message if node executable cannot be found #381

Closed
4 tasks done
fehmer opened this issue May 13, 2024 · 4 comments
Closed
4 tasks done

Comments

@fehmer
Copy link

fehmer commented May 13, 2024

Describe the bug

i'm using ubuntu linux and don't have a nodejs version installed globally but use nvm.
On opening vscode there is a popup There was an error during Vitest startup. and the output is this:

[INFO 1:06:28 PM] [v0.10.2] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 1:06:29 PM] [API] Running Vitest: v1.6.0 (vitest.config.js), v1.6.0 (vitest.config.js)
[Error 1:06:30 PM] [Error Error] spawn ENOTDIR
Error: spawn ENOTDIR
	at ChildProcess.spawn (node:internal/child_process:414:11)
	at spawn (node:child_process:799:9)
	at /home/user/.vscode/extensions/vitest.explorer-0.10.2/dist/extension.js:18:186

Best solution would be to use the default node version from nvm. If this is not possible improve the error message like Cannot find node executable, set vitest.nodeExecutable configuration in your workspace or make sure node is installed at <expected-path>

Reproduction

  • don't have node available globally
  • open project with vitest in vscode

Output

[INFO 1:06:28 PM] [v0.10.2] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 1:06:29 PM] [API] Running Vitest: v1.6.0 (vitest.config.js), v1.6.0 (vitest.config.js)
[Error 1:06:30 PM] [Error Error] spawn ENOTDIR
Error: spawn ENOTDIR
	at ChildProcess.spawn (node:internal/child_process:414:11)
	at spawn (node:child_process:799:9)
	at /home/user/.vscode/extensions/vitest.explorer-0.10.2/dist/extension.js:18:186

Version

0.10.2

Validations

@garyking
Copy link

garyking commented May 13, 2024

Is this a new issue? I just installed the Vitest extension a few days ago, and I get this error every time I open a workspace in VSC. Is there a previous version of this extension I can roll back to for now, that doesn't have this issue?

Edit: Okay, I can see that the issue starts with v0.8.0 of this extension. So I'm using 0.6.3 for now. Presumably caused by this change.

Is there something I can change to fix this on my end? I've got Node installed globally on my Mac, v20.11.0, at /usr/local/bin/node. I don't use nvm.

The funny thing is the extension still seems to work fine.

@sheremet-va
Copy link
Member

sheremet-va commented May 17, 2024

I also use nvm and it's working fine. The reproduction is not enough. What does which node return when you run it in a terminal? What OS are you using?

@fehmer
Copy link
Author

fehmer commented May 17, 2024

Thanks for the reply. The issue was how I openened vscode. Opening it from a commandline works.

@fehmer fehmer closed this as completed May 17, 2024
@garyking
Copy link

Thanks for the reply. The issue was how I openened vscode. Opening it from a commandline works.

This put me on the right path... I've posted my issue in #383.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants