EPERM operation not permitted, rmdir

I'm getting this error when I try to visit my dev site
8:43:09 PM [vite] error while updating dependencies:
Error: EPERM: operation not permitted, rmdir 'C:\Users\...\node_modules\.vite\deps'
8:43:09 PM [vite] error while updating dependencies:
Error: EPERM: operation not permitted, rmdir 'C:\Users\...\node_modules\.vite\deps'
I'm pretty sure I somehow corrupted by project. The Vite HMR wasn't working and I was trying to fix it. I did not change any config files, just tried starting vite with different flags. Anyways, if I look at my node_modules folder properties, the read-only checkbox is checked (Windows). Unchecking shows a progress bar and closes, but it is still checked if I reopen properties again. Googling hasn't helped (https://stackoverflow.com/questions/39293636/npm-err-error-eperm-operation-not-permitted-rename, https://stackoverflow.com/questions/58078937/eperm-operation-not-permitted-mkdir-c-program-files-nodejs-node-modules-sta). I've never had this problem with React, but I have several times with Solid JS. I'm sure it nothing with Solid JS, I just don't know if it's an issue with vite or something else. I'm sure it's something I did wrong, but have no idea what or how to fix it. If anyone has ran into this problem, and has a solution that would be great. As of now, my only work around is to delete node_modules and package-lock.json and reinstall everything. I really don't know why that works and I have to redo everytime any of my packages change.
Stack Overflow
npm ERR! Error: EPERM: operation not permitted, rename
When I execute npm install I get this error npm ERR! Error: EPERM: operation not permitted, rename C:\projects**\node_modules\react-async-script' -> 'C:\projects***\node_modules.react-a...
Stack Overflow
EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node...
I'm trying to run npm install on my project but its showing EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules.staging I don't have root administrative access. I'am using as
9 Replies
Brendan
Brendan2y ago
Someone on this thread said then had to run npm cache clean --force twice ...https://stackoverflow.com/questions/34600932/npm-eperm-operation-not-permitted-on-windows Hmm if you're already blowing away node-modules and starting again, it must be something related to your permissions on the parent folder. How did you start your project? Not downloading a ZIP file?
FutureLights
FutureLights2y ago
@brendan_csel Thanks! I have tried that without any luck. That is an idea, I've already tried giving "everyone" full control to node_modules without success, I didn't think about the parent. I created it using the npm create template command. I know it's not the official way anymore, I just haven't dedicated any time to learning the new way. I didn't have any issues until I tried to fix my issues with vite hmr so I'm guessing its something I did with that somehow.
Brendan
Brendan2y ago
It is also curious you mention you've not had any issues with react projects, but you have with solid. Are they all under the same parent folder, or are your React projects in a different place? If so, perhaps compare the permissions and owner on each of those folders too.
FutureLights
FutureLights2y ago
My file structure is like websites/solidjs/project-name and for react it is websites/react/project-name, but I don't have this issue for all my SolidJS projects, just like two or three so far out of many. I think I'll just copy the critical files over to another folder and delete the rest. That should fix my issue. Thanks for your help!
Brendan
Brendan2y ago
Glad to hear it. Feel free to close this thread if you're happy to.
FutureLights
FutureLights2y ago
Sure, just clicking the green check mark does that right?
Brendan
Brendan2y ago
I'm actually not sure. Apparently there is some "Close" option at the top. It moves the thread into an "older posts" area so folks looking to help don't need to review it all again.
FutureLights
FutureLights2y ago
Ah got it, it's under the three dots
Brendan
Brendan2y ago
Thanks - I'll know how to describe it better next time now 😅