Error: ENOTEMPTY: directory not empty, rmdir '/app/node_modules/.vite/dep'


Our React project suddenly crashed and is getting this error. Did anyone encounter this kind of problem? I’ll add the whole log

error when starting dev server:

Error: ENOTEMPTY: directory not empty, rmdir ‘/app/node_modules/.vite/deps’

at rmdirSync (fs.js:706:3)

at removeDirSync (/rbd/pnpm-volume/f1106cdb-a616-46d9-93cf-7dee293861b3/node_modules/vite/dist/node/chunks/dep-611778e0.js:37278:9)

at loadCachedDepOptimizationMetadata (/rbd/pnpm-volume/f1106cdb-a616-46d9-93cf-7dee293861b3/node_modules/vite/dist/node/chunks/dep-611778e0.js:37058:5)

at createOptimizedDeps (/rbd/pnpm-volume/f1106cdb-a616-46d9-93cf-7dee293861b3/node_modules/vite/dist/node/chunks/dep-611778e0.js:58475:28)

at Server.httpServer.listen (/rbd/pnpm-volume/f1106cdb-a616-46d9-93cf-7dee293861b3/node_modules/vite/dist/node/chunks/dep-611778e0.js:59049:45)
1 Like

I’ve also been encountering this problem, and it’s really, really weird how it’s happening.
I have a project saved from a while ago using a Vite frontend and an Express backend, and it works perfectly fine. However, if you remix it, it suddenly breaks with that exact error.

The newest versions of Vite just seem to brick Glitch. Downgrading to v2.8.6 worked for me.


can you do a ls -al /app/node_modules/.vite/ the next time this happens?

I searched around for that path, and it looks like it’s configurable. if the node_modules is behaving too weird (it’s got some mystery to it with how Glitch separates it from your app storage), maybe try something like /tmp/vite :person_shrugging:

1 Like