Skip to content

How to Fix Vite Project Creation Issues Caused by Chocolatey Node.js Installation

I tried to create a new Vite project on Windows and got this error:

Terminal output
npm create vite@latest
npm ERR! could not determine executable to run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\[username]\AppData\Local\npm-cache\_logs\[timestamp]-debug-0.log

After three hours of debugging, I discovered the culprit: Chocolatey. The Node.js installer had silently installed a Chocolatey-managed version of Node.js alongside the official one, creating PATH conflicts that broke npm and npx.

The Root Cause

I had installed Node.js using the official Windows installer from nodejs.org. Everything seemed fine at first. But when I tried running npm create vite@latest, the command would either fail silently or produce cryptic errors about missing executables.

The issue? During the Node.js installation, I had left the default options checked. One of those defaults automatically installs Chocolatey and uses it to manage the Node.js installation. This creates a situation where you have two competing Node.js installations:

  1. The official Node.js installation
  2. A Chocolatey-managed Node.js installation

The PATH environment variable gets confused about which npm and npx to use, leading to inconsistent behavior.

Verifying the Problem

First, I checked which Node.js installations existed on my system:

Check Node.js installations
where.exe node

The output revealed the problem:

Command output
C:\Program Files\nodejs\node.exe
C:\ProgramData\chocolatey\bin\node.exe

Two different Node.js installations. The Chocolatey one was interfering with the official installation.

I also checked npm and npx:

Check npm and npx locations
where.exe npm
where.exe npx

Both commands returned mixed paths pointing to different installations. This mismatch between where node, npm, and npx lived was causing the npm create vite@latest command to fail.

The Fix: Clean Reinstallation

The solution was to completely remove Node.js and reinstall it without Chocolatey involvement.

Step 1: Uninstall via the Node.js Installer

I downloaded the official Node.js installer from nodejs.org again. Running it with an existing installation presents a maintenance mode dialog:

  1. Run the Node.js installer (the same .msi file you used before)
  2. Select “Remove” when prompted
  3. Complete the removal process

But here is the catch: running the uninstaller once might not catch everything, especially if Chocolatey installed its own instance.

Step 2: Remove Chocolatey’s Node.js

I needed to check if Chocolatey still had Node.js installed:

List Chocolatey packages
choco list --local-only

If you see nodejs or nodejs-lts in that list, remove it:

Remove Node.js via Chocolatey
choco uninstall nodejs

I also manually removed any remaining Node.js directories:

Clean up remaining directories
Remove-Item -Recurse -Force "C:\Program Files\nodejs"
Remove-Item -Recurse -Force "C:\ProgramData\chocolatey\lib\nodejs"

Step 3: Clean PATH and Environment Variables

After removal, I checked the system PATH to ensure no stale references remained:

Check system PATH
$env:PATH -split ';' | Where-Object { $_ -match 'nodejs|chocolatey' }

If any orphaned paths remain, you need to remove them manually:

  1. Open System Properties (Win + R, type sysdm.cpl)
  2. Go to Advanced > Environment Variables
  3. Edit both User and System PATH variables
  4. Remove any paths containing nodejs or chocolatey that look orphaned

Step 4: Reinstall Node.js (The Right Way)

Now for the critical part. I ran the Node.js installer again, but this time I paid close attention to the options:

  1. Download the Windows Installer (.msi) from nodejs.org
  2. Run the installer
  3. Accept the license agreement
  4. On the “Custom Setup” page, click each feature and examine the options
  5. Look for any checkbox that mentions “Automatically install Chocolatey” or similar
  6. Uncheck that option

The exact location of this checkbox varies between Node.js versions, but it is typically on the “Custom Setup” or “Additional Tasks” page of the installer wizard.

Step 5: Verify the Clean Installation

After installation, I verified everything worked:

Verify Node.js installation
node -v
npm -v

Both commands returned version numbers without errors.

Then I checked that only one Node.js installation existed:

Confirm single installation
where.exe node

This time, the output showed only one path:

Command output
C:\Program Files\nodejs\node.exe

Perfect. A clean, single installation.

Step 6: Test Vite Project Creation

Finally, I tested the original command that failed:

Create Vite project
npm create vite@latest my-project
cd my-project
npm install
npm run dev

The project created successfully, and the dev server started without issues.

Why This Happens

The Node.js installer includes an option to use Chocolatey for package management. When checked, it installs Chocolatey and registers Node.js as a Chocolatey package. This creates two parallel installations:

  1. The installer copies Node.js to C:\Program Files\nodejs\
  2. Chocolatey creates symlinks or copies to C:\ProgramData\chocolatey\bin\

Both get added to PATH. When you run npm or npx, Windows finds the first match, but the executables might be from different installations. This breaks commands like npm create that rely on npx being properly integrated with npm.

Alternative Solutions

While the official installer approach worked for me, there are other ways to avoid this issue entirely:

Use a Version Manager

Tools like mise (formerly rtx) or nvm-windows manage Node.js versions without system-wide PATH modifications:

Install and use Node.js with mise
mise install node@22
mise use node@22

This approach keeps Node.js isolated and makes version switching painless.

Use WSL

The top comment on my Reddit thread suggested using Windows Subsystem for Linux (WSL). WSL provides a proper Linux development environment without Windows PATH quirks:

Install Node.js on WSL Ubuntu
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs

This eliminates Chocolatey conflicts entirely since Chocolatey does not run on Linux.

Lessons Learned

  1. Always review installer options: Default checkboxes are not always optimal for development environments
  2. Verify installations: Run where.exe node after installing to catch duplicate installations early
  3. One package manager at a time: Mixing Chocolatey, Scoop, and official installers on the same machine creates conflicts
  4. Test critical commands: After installing Node.js, immediately test npm -v, npx -v, and npm create vite@latest to catch issues before they waste hours

The fix itself took ten minutes once I understood the problem. The three hours I lost came from not realizing that the Node.js installer had added Chocolatey without my explicit knowledge.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments