Vitest not starting up due to failed version check on windows
Describe the bug Hi there, Every time I start up vscode it keeps telling me, "Because Vitest version < 0.12.0 for every workspace folder, run/debug/watch tests from Vitest extension disabled."
Tried uninstall / install but it won't come up again.
Sth. I should be aware off ?
Thx!
To Reproduce have vitest 0.23.4 installed, used the cmd: npm init vue@3 to create a totally new package
installed your vitest extension.
Restart vscode, see error appearing.
Expected behavior possible to start the tests through test explorer or using the green play icon
Screenshots
If applicable, add screenshots to help explain your problem.

Environment windows 10, vscode : Version: 1.71.2 (user setup) Commit: 74b1f979648cc44d385a2286793c226e611f59e7 Datum: 2022-09-14T21:03:37.738Z Electron: 19.0.12 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 Betriebssystem: Windows_NT x64 10.0.19044 Sandkasten: No
- OS: [e.g. macOS]
- VSCode version:
- Vitest version:
- Vitest plugin version:
Additional context same setup on macos works
I got the same warning on MacOS
Vitest Plugin: 0.2.29
Vitest: 0.23.4
vscode: 1.17.2
MacOS: 11.4
same warning on MacOS
I have the same issue on a Mac, here's an example repo https://github.com/philwolstenholme/wolstenhol-11ty/
Extension version v0.2.29
Vitest version 0.24.0
Vite version: 3.1.0
Same issue on Ubuntu 20.04.5.
Extension version v0.2.32 Vitest version 0.22.1 Vite version: 3.0.8 vscode: 1.72.0
I've seen this as well on Windows with Ubuntu 22.04 on WSL. I suspect the root cause could be a bug in vscode-server.
At least in my case when I've seen this, shutting down all VSCode instances and restarting has cleared up the problem, but it still re-occurs at random. I'll try to investigate a bit more if I see it again.
I suspect when this happens the extension does not even have a Vitest version number.
Same issue on Ubuntu 22.04 Extension version v0.2.32 Vitest version 0.24.3 Vite version: 3.1.4 vscode: 1.73.0
Same, doesn't run tests on OS X Ventura.
Same here: macOS 13.0.1 Vitest 0.25.2 vitest-vscode 0.2.34
Same here Windows 11 Vitest 0.26.3 vitest-vscode 0.2.35
I clicked Vitest: Enable assuming that was required...
I think that I found a fix: the problem seems to come from node not being installed globally, but by a version manager (in my case n).
I think that I found a fix: the problem seems to come from node not being installed globally, but by a version manager (in my case
n).
This makes perfect sense, I have nvm for windows, I wonder how many people share the same environment...
Just out of curiosity, what are the next steps in a case like this? Do people take it on themselves to try to fix the bug? Have you already done that? Apologies if that's a noob question!
I think that I found a fix: the problem seems to come from node not being installed globally, but by a version manager (in my case
n).
I can confirm this. I originally installed Node on my MacOS machine via NVM, and I was having this issue. I just went and downloaded the installer from https://nodejs.org/en/download/ and installed Node through the wizard.
Restarted VSCode a couple times, and now I'm getting test results in the UI!
Thanks for the reproduction. The issue is not limited to Windows, I'm having it on macOS as well.
As for the next step, I've created a PR (https://github.com/vitest-dev/vscode/pull/118), I'm waiting for the maintainers to review it.
same problem here
Sorry, but the "fix" in PR #118 actually caused this to start happening again for me. I had to revert to the previous version (v0.2.36) in order to not get the above error.
Some details:
- I'm on Windows with Ubuntu 22.04 on WSL.
- All installations of Node are managed via nvm.
At some point in the past, I had set the setting remote.WSL.useShellEnvironment to false. ("If set [true], the WSL windows gets the environment from the shell it was opened from.")
For versions of the extension prior to the current (< v0.2.37), when I set remote.WSL.useShellEnvironment back to the default (true), the extension would identify the vitest version correctly, provided that VSCode was started from the Linux command line in the proper environment (as opposed to the Windows desktop where it would still fail).
For the current version (v0.2.37), I get Vitest version = undefined and Because Vitest version < 0.12.0 ... regardless of the remote.WSL.useShellEnvironment setting. Reverting to the previous extension version now fixes the problem for me.
Hi Jonathan,
(I'm not the maintainer, just a contributor)
I'm sorry that the change broke your setup.
I don't have any windows machine to reproduce the bug.
I don't know if there's a reliable way to determine when we should pass the process.execPath param or not (maybe there are some env variables that differ?).
We could maybe do it this way:
- launch vitest without passing the process.execPath
- if it fails, launch it with the process.execPath param.
Lorentz, Braden, Lucas the fix was merged, does it now work on your end?
Best, Nicolas
On Fri, Jan 20, 2023 at 9:41 AM Jonathan Kimball @.***> wrote:
Sorry, but the "fix" in PR #118 https://github.com/vitest-dev/vscode/pull/118 actually caused this to start happening again for me. I had to revert to the previous version (v0.2.36) in order to not get the above error.
Some details:
- I'm on Windows with Ubuntu 22.04 on WSL.
- All installations of Node are managed via nvm.
At some point in the past, I had set the setting remote.WSL.useShellEnvironment to false. ("If set [true], the WSL windows gets the environment from the shell it was opened from.")
For versions of the extension prior to the current (< v0.2.37), when I set remote.WSL.useShellEnvironment back to the default (true), the extension would identify the vitest version correctly, provided that VSCode was started from the Linux command line in the proper environment (as opposed to the Windows desktop where it would still fail).
For the current version (v0.2.37), I get Vitest version = undefined and Because Vitest version < 0.12.0 ... regardless of the remote.WSL.useShellEnvironment setting. Reverting to the previous extension version now fixes the problem for me.
— Reply to this email directly, view it on GitHub https://github.com/vitest-dev/vscode/issues/88#issuecomment-1398074211, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAENRQHQVUTCKKICGZGD3VLWTJFTNANCNFSM6AAAAAAQYTBHZY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I am getting the same error on Windows.
Hi Aniket,
I'll try to work on a fix.
On Sun, Jan 22, 2023 at 9:20 AM Aniket Pandharabale < @.***> wrote:
I am getting the same error on Windows.
— Reply to this email directly, view it on GitHub https://github.com/vitest-dev/vscode/issues/88#issuecomment-1399428277, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAENRQEOQLJS56TORIPFMZLWTTUTBANCNFSM6AAAAAAQYTBHZY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@JAKimball @aniketicloud, could you try https://github.com/vitest-dev/vscode/pull/125 to see if it fixes the issue?
- git clone https://github.com/ngirardin/vscode.git
- git checkout better-version-detection
- npm install
- npm run compile
- Click on "Run and Debug", then in the panel select "Run Extension Base" and click on the play icon
A new VSCode window will open, try to open a few projects, and please let me know if the extensions detect the version.
@ngirardin Works with the project I was having issues :)
@JAKimball @aniketicloud, could you try #125 to see if it fixes the issue?
- git clone https://github.com/ngirardin/vscode.git - git checkout better-version-detection - npm install - npm run compile - Click on "Run and Debug", then in the panel select "Run Extension Base" and click on the play iconA new VSCode window will open, try to open a few projects, and please let me know if the extensions detect the version.
- I followed the same steps.
- In vscode root folder, the Vitest plugin is not able to get the version.
- When I did Run and Debug, then new VS Code opened. In this new window, I clicked on run the test (left side arrow in test file), but now test runs and are not stopping.
Thank you guys, I'll submit the PR for review
I set vitest.enable to true in .vscode/settings.json, and the extension is forced to open. The sidebar appears, but warnings are still there, and I cannot run tests in editor.
Looking forward to the fix!
OS: Arch WSL Extension version: v0.2.37
@mrcaidev did you tried the steps in https://github.com/vitest-dev/vscode/issues/88#issuecomment-1400769734 ?
@mrcaidev did you tried the steps in #88 (comment) ?
npm run compile can't resolve birpc and flatted.
Error log
CLI Building entry: ./src/extension.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v5.12.9
CLI Target: node12
CJS Build start
✘ [ERROR] Could not resolve "birpc"
src/pure/watch/ws-client.ts:5:28:
5 │ import { createBirpc } from 'birpc'
╵ ~~~~~~~
You can mark the path "birpc" as external to exclude it from the bundle, which will remove this
error.
✘ [ERROR] Could not resolve "flatted"
src/pure/watch/ws-client.ts:6:33:
6 │ import { parse, stringify } from 'flatted'
╵ ~~~~~~~~~
You can mark the path "flatted" as external to exclude it from the bundle, which will remove this
error.
CJS Build failed
Error: Build failed with 2 errors:
src/pure/watch/ws-client.ts:5:28: ERROR: Could not resolve "birpc"
src/pure/watch/ws-client.ts:6:33: ERROR: Could not resolve "flatted"
...
Did you run npm install first?
On Thu, Jan 26, 2023 at 4:30 AM Yuwang Cai @.***> wrote:
@mrcaidev https://github.com/mrcaidev did you tried the steps in #88 (comment) https://github.com/vitest-dev/vscode/issues/88#issuecomment-1400769734 ?
npm run compile can't resolve birpc and flatted. Error log
CLI Building entry: ./src/extension.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v5.12.9
CLI Target: node12
CJS Build start
✘ [ERROR] Could not resolve "birpc"
src/pure/watch/ws-client.ts:5:28: 5 │ import { createBirpc } from 'birpc' ╵ ~~~~~~~You can mark the path "birpc" as external to exclude it from the bundle, which will remove this
error.
✘ [ERROR] Could not resolve "flatted"
src/pure/watch/ws-client.ts:6:33: 6 │ import { parse, stringify } from 'flatted' ╵ ~~~~~~~~~You can mark the path "flatted" as external to exclude it from the bundle, which will remove this
error.
CJS Build failed
Error: Build failed with 2 errors:
src/pure/watch/ws-client.ts:5:28: ERROR: Could not resolve "birpc"
src/pure/watch/ws-client.ts:6:33: ERROR: Could not resolve "flatted"
...
— Reply to this email directly, view it on GitHub https://github.com/vitest-dev/vscode/issues/88#issuecomment-1404525551, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAENRQC4VAJMZIEJUQMAHFDWUHVWRANCNFSM6AAAAAAQYTBHZY . You are receiving this because you were mentioned.Message ID: @.***>
Did you run
npm installfirst?
Solved. I installed it with pnpm and somehow the dependencies broke, but with npm it works well.
And the extension works perfectly in the debug session. ❤️
Thanks, I'm glad to be here! I'm waiting for a maintainer to merge the pull request.
On Thu, Jan 26, 2023 at 9:34 AM Yuwang Cai @.***> wrote:
Did you run npm install first? … <#m_3573095887877003356_> On Thu, Jan 26, 2023 at 4:30 AM Yuwang Cai @.> wrote: @mrcaidev https://github.com/mrcaidev https://github.com/mrcaidev https://github.com/mrcaidev did you tried the steps in #88 https://github.com/vitest-dev/vscode/issues/88 (comment) <#88 (comment) https://github.com/vitest-dev/vscode/issues/88#issuecomment-1400769734> ? npm run compile can't resolve birpc and flatted. Error log CLI Building entry: ./src/extension.ts CLI Using tsconfig: tsconfig.json CLI tsup v5.12.9 CLI Target: node12 CJS Build start ✘ [ERROR] Could not resolve "birpc" src/pure/watch/ws-client.ts:5:28: 5 │ import { createBirpc } from 'birpc' ╵ ~~~~~~~ You can mark the path "birpc" as external to exclude it from the bundle, which will remove this error. ✘ [ERROR] Could not resolve "flatted" src/pure/watch/ws-client.ts:6:33: 6 │ import { parse, stringify } from 'flatted' ╵ ~~~~~~~~~ You can mark the path "flatted" as external to exclude it from the bundle, which will remove this error. CJS Build failed Error: Build failed with 2 errors: src/pure/watch/ws-client.ts:5:28: ERROR: Could not resolve "birpc" src/pure/watch/ws-client.ts:6:33: ERROR: Could not resolve "flatted" ... — Reply to this email directly, view it on GitHub <#88 (comment) https://github.com/vitest-dev/vscode/issues/88#issuecomment-1404525551>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAENRQC4VAJMZIEJUQMAHFDWUHVWRANCNFSM6AAAAAAQYTBHZY https://github.com/notifications/unsubscribe-auth/AAENRQC4VAJMZIEJUQMAHFDWUHVWRANCNFSM6AAAAAAQYTBHZY . You are receiving this because you were mentioned.Message ID: @.>
Solved. I installed it with pnpm and somehow the dependencies broke, but with npm it works well.
And the extension works perfectly in the debug session. ❤️
— Reply to this email directly, view it on GitHub https://github.com/vitest-dev/vscode/issues/88#issuecomment-1404690729, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAENRQBBQGZ6CWMVQXPZ4HDWUIZJTANCNFSM6AAAAAAQYTBHZY . You are receiving this because you were mentioned.Message ID: @.***>
Not every workspace root in my project is a JS project. But I think I should still be able to use run/debug/watch in my JS workspace roots. Will #125 work for my case? I ask because the error message suggests it may not...
Is there a workaround for pnpm users while we wait for #125?