Fixing the Lucide-React chrome.js
Error on Windows: A Developer’s Survival Guide 🎨⚡
If you’re building a React project with Vite + lucide-react and suddenly hit this:
X [ERROR] Could not resolve "./icons/chrome.js"
X [ERROR] Could not resolve "./chrome.js"
Don’t panic.
This is a known hiccup with lucide-react
on Windows. The culprit?
That innocent file:
node_modules/lucide-react/dist/esm/icons/chrome.js
…it sometimes gets quarantined by Windows Defender/antivirus, or newer lucide builds have trouble shipping the Chrome icon on Windows environments. 🪟🐞
Let’s break down how to fix it — with options from quick hacks to long-term solutions.
Option A — Upgrade & Reinstall (the clean fix)
Most of the time, simply upgrading to the latest lucide-react release will get you back in business.
npm i lucide-react@latest
Then wipe and reinstall your dependencies:
rm -rf node_modules package-lock.json
npm cache clean --force
npm i
npm run dev
👉 The lucide team ships continuously. As of writing, 0.541.0 is live.
Option B — Restore/Unblock the File in Windows
Windows Defender can be a little overprotective and silently quarantine chrome.js
.
Steps:
- Open Windows Security → Virus & Threat Protection → Protection History
- Restore or whitelist
chrome.js
(or the whole project folder). - Reinstall your dependencies:
rm -rf node_modules
npm i
npm run dev
After this, Vite should stop complaining.
Option C — Drop the “Chrome” Brand Icon
Here’s a twist:
Lucide doesn’t actually support brand icons anymore. The maintainers recommend Simple Icons for that.
So, if you’re importing { Chrome }
anywhere, swap it for another neutral icon:
import { Globe } from "lucide-react"; // instead of Chrome
Cleaner, safer, and future-proof.
Option D — Quick Fallback: Pin a Stable Version
If you just need your project running fast (demo, hackathon, class deadline):
npm i lucide-react@0.263.1
That version is known to play nicely across Windows setups.
Extra Sanity Checks
OneDrive + Node Modules = Chaos
If your project lives underOneDrive/Documents
, Defender may constantly lock files.
→ Move it toC:\dev\my-app
or any unsynced path.Search for Chrome imports
Make sure you’re not pulling inChrome
anywhere:
# Linux/Mac
grep -R "Chrome" -n src
# Windows PowerShell
Select-String -Path . -Pattern "Chrome"
Wrap-up
If you’re battling the dreaded Could not resolve './icons/chrome.js'
error, you’ve got four lifelines:
- Option A: Upgrade + reinstall (best practice)
- Option B: Restore from Defender quarantine
- Option C: Stop using the Chrome brand icon
- Option D: Pin a known-good version
💡 Pro tip: Always favor Option A first. If your build still breaks and you must use the Chrome logo, either restore the file (Option B) or swap the icon (Option C).
🔥 That’s it — a developer’s field guide to squashing this pesky lucide-react
bug on Windows.
Drop a 💬 in the comments if you found another creative fix!
✍ Written by: Cristian Sifuentes – Full-stack dev crafting scalable apps with [.NET - Azure], [Angular - React], Git, SQL & AI integrations. Dark mode, clean code, and atomic commits enthusiast.
Top comments (0)