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

Unable to find 'node' executable when using VSCode on Windows with fnm (Fast Node Manager) #486

Open
4 tasks done
jpierson-at-riis opened this issue Oct 3, 2024 · 4 comments

Comments

@jpierson-at-riis
Copy link

Describe the bug

I'm unable to use this extension in VSCode due to the extension not being able to find the node executable. In my environment I use fnm which is configured properly to run in all of my shells. Other plugins such as those for Jest and the VSCode debuger have had similar issues with version managers but normally there is a way to configure the extension to resolve the node path through a specific configuration.

Reproduction

  1. Ensure no other Node.js installations exist
  2. Install fnm (winget install "Schniz.fnm")
  3. Install VSCode
  4. Open a project which uses vitest
  5. Install the vitest-dev extension through the extension in VSCode

Output

[Error 8:27:31 AM] [Error Error] Unable to find 'node' executable.
Make sure to have Node.js installed and available in your PATH.
Current PATH: 'C:\Program Files\OpenSSH\;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\java8path;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\IBM\Client Access\Emulator;C:\Program Files (x86)\IBM\Client Access\Shared;C:\Program Files (x86)\IBM\Client Access\;C:\Windows\CCM;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Perforce\;C:\Program Files\Seq\;C:\Program Files\Seq\Client\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\Program Files\PuTTY\;C:\Program Files\PowerShell\7\;C:\Users\myuser\AppData\Local\Microsoft\WindowsApps;C:\Users\myuser\.dotnet\tools;C:\Users\myuser\AppData\Local\Microsoft\dotnet\;C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\myuser\AppData\Local\Programs\Git\cmd;C:\tools\java-1.8.0-openjdk-1.8.0.352-2.b08.redhat.windows.x86_64;C:\Users\myuser\.jabba;C:\Users\myuser\.jabba\jdk\17.0.1-redhat\bin;C:\tools\node-v18.12.0-win-x64-disabled;C:\tools\node-v16.15.0-win-x64-disabled;C:\tools\node-v16.14.0-win-x64-disabled;C:\tools\node-v12.14.1-win-x64-disabled;C:\Users\myuser\AppData\Local\nvs;C:\tools\python-3.10.4-embed-amd64;C:\tools\python-2.7.16.amd64-pdb;C:\tools\apache-maven-3.9.2\bin;C:\tools\apache-maven-4.0.0-alpha-5\bin;C:\tools\maven;C:\Program Files\Azure Data Studio\bin;C:\Users\myuser\AppData\Local\Microsoft\WinGet\Packages\Schniz.fnm_Microsoft.Winget.Source_8wekyb3d8bbwe\;C:\tools\libwebp-1.3.2-windows-x64\bin;C:\Users\myuser\.dotnet\tools'.

Version

v1.2.18

Validations

@jpierson-at-riis
Copy link
Author

Ok, so searching the issues didn't turn up any results for me initially but after briefly reading through the README.md I see the the vitest.nodeExecutable option that is provided. For version managers which determine the version through the shell context though I'm not sure how to make this work effectively for a large number of separate projects which may use different versions of node.

Based on my limit knowledge on this extension, one option might be to default to a single version of node on the system for the purpose of running this extension by taking advantage of the vitest.nodeExecutable to hard code a path to a specific version of node installed through fnm. I've had issues doing a similar thing with a Jest extension in that it was sensitive to different versions of node across projects. Another option would be to potentially have vitest launch node on Windows with something similar to ShellEexecute or through the default shell (Powershell on Windows 10+) instead of running the node executable directly.

@jpierson-at-riis
Copy link
Author

It appears that this may be a similar issue to the on pointed out in #381 which didn't seem to come to a great conclusion but it also looks like some related discussion is happening in #383 but with a different focus on on intermittent issues.

@sheremet-va
Copy link
Member

Would this option fix your issue? #490

@mrmckeb
Copy link

mrmckeb commented Oct 10, 2024

Hi @jpierson-at-riis, we're using this extension with fnm, but my team are all on macOS. It may be a Windows path issue?

We also use fnm with --use-on-cd which may also fix your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants