[Tip] Fix for Playwright "HOME environment variable is not set" on Windows

If you are using AI agents or Playwright-based tools on Windows and encounter the following error:

failed to install playwright: $HOME environment variable is not set

This happens because the tool expects a Linux-style $HOME environment variable, which is not set by default on Windows (Windows uses %USERPROFILE%).

Solution

You can easily fix this by setting the HOME environment variable to your user profile path.

Run this command in PowerShell:

[System.Environment]::SetEnvironmentVariable('HOME', $env:USERPROFILE, 'User')

After running the command, restart your IDE or terminal for the changes to take effect.

Verified this fixes the browser launch issues in agentic workflows. Hope this helps anyone facing the same issue!

4 Likes

Thank you! Been trying to figure out the fix for that ever since google broke it a couple weeks ago!

Thank you for your valuable help. I spent hours fixing this, and thanks to you everything is back in order