4

I am trying to use Vite for a web development project on my Windows machine. However, I keep getting the error message: Error: Cannot find module 'fsevents' [plugin:vite:import-analysis] Failed to resolve import "fsevents" from "node_modules.vite\deps\chunk-7EWWWNQA.js?v=554e11ec". Does the file exist?

23275| async function loadFsEvents() { 23276| try { 23277| ({ default: fsEvents } = await import("fsevents")); | ^ 23278| } catch (error2) { 23279| fsEventsImportError = error2;

I have tried uninstalling the fsevents package and deleting node modules several times, but the error persists. I also tried running the command npm audit fix --force, but it did not help either.

How can I resolve this error and use Vite on my Windows machine?

  • `fsevents` is Mac only and your Windows machine should be skipping that dependency. Is there anything peculiar about your setup? – Andy Apr 01 '23 at 08:12

1 Answers1

15

Check if you have any weird imports in any of your components. Sometimes autocomplete imports things by accident. I just resolved the same problem by deleting

import { SplitVendorChunkCahe } from 'vite'

line from a file.