Open garyking opened 2 months ago
I get this too. But only sporadically. When I then run a particular test again, it sometimes passes, but not always.
My tests use dotenv
. Is that the same for you?
I don't use dotenv
.
Alright, so unrelated to dotenv. No idea why it is happening then. The weird part is even that if I run all my tests, sometimes it'll happen only for a subset of the tests.
So hard to repro though 😄
Do you have Node available globally? What shell do you use by default? What does which node
return when you run it from the working directory?
When I run which node
, it returns /usr/local/bin/node
. So I suppose it is available globally. The version seems to be v20.13.1
currently.
I am running inside a DevContainer. The image is based on the node:lts
base image.
Do you have Node available globally? What shell do you use by default? What does
which node
return when you run it from the working directory?
Yes I have Node available globally. which node
returns /usr/local/bin/node
. I'm using Node v20.11.0. The shell I use is Bash. I'm not using Dev Containers. I'm on MacOS Sonoma 14.4.1.
This comment put me on the right path. If I open a .code-workspace
file through Mac Finder, then the error appears. If I open the file through Bash with code Finder.code-workspace
then the error does not appear.
I normally open VSC workspace files through the Finder, so I'd appreciate if that's fixed, thanks!
I am not using workspaces at all. But for me it also only happens sporadically. When it happens, I just have to retry running the test a couple of more times, and it'll work again.
Is reported output the full output? I don't understand why it doesn't report the current PATH
or Starting Vitest process with Node.js
string
Added more logs in 0.10.6
Posted new logs here, Unable to find 'node' executable.
seems pretty relevant, it's not looking in /usr/local/bin/
for node
apparently.
[INFO 3:30:40 PM] [v0.10.7] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 3:30:40 PM] [API] Running Vitest: v1.6.0 (vitest.config.ts)
[Error 3:30:41 PM] [SPAWN] /bin/bash [Error Error] spawn ENOTDIR
Error: spawn ENOTDIR
at ChildProcess.spawn (node:internal/child_process:414:11)
at spawn (node:child_process:799:9)
at /Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:18:496
at new Promise (<anonymous>)
at gf (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:18:414)
at Rt (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:16:871)
at vf (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:18:4257)
at Ef (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:21:683)
at so (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:18:3760)
at Er.defineTestProfiles (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:27:2375)
at Er.activate (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:27:5404)
at sd (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:27:759)
at h.n (/Applications/Development/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:6281)
at h.m (/Applications/Development/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:6244)
at h.l (/Applications/Development/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:5701)
[Error 3:30:41 PM] Unable to find 'node' executable.
Make sure to have Node.js installed and available in your PATH.
Current PATH: '/usr/bin:/bin:/usr/sbin:/sbin'.
[Error 3:30:41 PM] [Error Error] Unable to find 'node' executable.
Make sure to have Node.js installed and available in your PATH.
Current PATH: '/usr/bin:/bin:/usr/sbin:/sbin'.
Error: Unable to find 'node' executable.
Make sure to have Node.js installed and available in your PATH.
Current PATH: '/usr/bin:/bin:/usr/sbin:/sbin'.
at Rt (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:18:56)
at vf (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:18:4257)
at Ef (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:21:683)
at so (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:18:3760)
at Er.defineTestProfiles (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:27:2375)
at Er.activate (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:27:5404)
at sd (/Users/gary/.vscode/extensions/vitest.explorer-0.10.7/dist/extension.js:27:759)
at h.n (/Applications/Development/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:6281)
at h.m (/Applications/Development/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:6244)
at h.l (/Applications/Development/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:5701)
Describe the bug
I open a workspace in VSC that has Vitest. I get the error as seen below.
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.Otherwise, the extension still seems to work fine.
This issue seems different from #381 since I don't use NVM.
Reproduction
Output