cli
cli copied to clipboard
[BUG] npm ERR! Error: EPERM: operation not permitted only on windows
Is there an existing issue for this?
- [x] I have searched the existing issues
This issue exists in the latest npm version
- [x] I am using the latest npm
Current Behavior
Hello,
For our dependency, Dash.js 5.0, we need to use Node 20.18.0, so npm 10.8.2 was installed with this Node version. However, when we run npm install on Windows, we encounter the error: ERR! Error: EPERM: operation not permitted, while it works fine on Mac.
Could you please assist us in fixing this issue with npm 10.8.2?
Expected Behavior
npm install works fine on windows as Mac
Steps To Reproduce
- In this environment : Windows
- With this config...
- Run : run npm install
- See error : npm ERR! Error: EPERM: operation not permitted only on windows
Environment
- npm:10.8.2
- Node.js:20.18.0
- OS Name:Windows
@testeur-990 Based on the report It's hard to determine the cause of the issue but generally with windows if this occurs then you can try removing node_modules and reinstalling your dependency
Hello @milaninfy , We tried what was mentioned and many other solutions we found, but we still have an issue with npm 10.8.2. I believe you can easily reproduce it by trying Node 20.18.0 with npm 10.8.2 on Windows (no issue on Mac).
For now, we have switched to Node 20.0.0, which uses npm 9.6.4, and it worked fine. We hope you can help us use npm 10.x.
Thank you
I suspect I'm seeing the same issue here -- https://github.com/TypeStrong/typedoc/actions/runs/13469139132
This job started failing randomly on Windows only after merging another branch. I tried several different versions of npm, downgrading some recently updated dependencies, but going back to 9.x doesn't seem to fix things for me... I'm tired of fighting it, and pnpm install seems to just work, so plan on going that route for now.
After so many trial and errors this chatgpt response saved my life. If it works for you i'll be more than happy.
If you're experiencing errors like cb.apply is not a function, EPERM: operation not permitted, or The "file" argument must be of type string, follow this guide to fully reset your Node.js & npm setup using nvm-windows.
Step 1: Uninstall Existing Node.js
- Go to "Add or Remove Programs"
- Uninstall anything named Node.js
- Delete the following folders (if they exist):
Remove-Item -Recurse -Force "$env:ProgramFiles\nodejs" -ErrorAction SilentlyContinue Remove-Item -Recurse -Force "$env:AppData\npm" -ErrorAction SilentlyContinue Remove-Item -Recurse -Force "$env:AppData\npm-cache" -ErrorAction SilentlyContinue
Step 2: Install nvm-windows
-
Download the latest version from: 👉 https://github.com/coreybutler/nvm-windows/releases/latest
-
Run the downloaded
nvm-setup.exefile.
Step 3: Install Node.js 20 (LTS - Recommended)
Open PowerShell as Administrator, then run:
nvm install 20 nvm use 20
Verify Installation
node -v # Should show: v20.x.x npm -v # Should show: 9.x or 10.x
You're now using a clean, stable version of Node.js and npm via
nvm. This should fix most environment-level issues.