EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging
Solution 1
Try clearing the cache:
npm cache clean --force
Or
npm uninstall npm -g
npm install npm -g
Or
npm set prefix 'C:\Users\User\AppData\Roaming\npm'
The last one worked for me
Solution 2
run these commands:
npm uninstall -g create-react-app
npm install -g create-react-app
that's will upgrade your npx, then run
npx create-react-app my-app
Solution 3
Open your command line (CMD) as an admin. Navigate to your project directory. Install the package globally e.g nodemon or any other npm package.
This worked for me.
Solution 4
Delete 'C:\Users\User\AppData\Roaming\npm' folder or just rename it (like to 'npm_') to be on safe side, and then run command:
npm install
this will create 'C:\Users\User\AppData\Roaming\npm' folder again.
This worked for me.
Solution 5
on windows 10 👍
From Start Menu : type "CMD" then "run as administrator" then continue using "Node Commands"
venu kumar
Updated on March 21, 2021Comments
-
venu kumar about 3 years
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 local user in my system and my system is windows 10
node v10.16.3 npm v6.11.3
Can any one please help me to resolve this issue. I'am requesting you guys please.
3235 error code EPERM 3236 error syscall mkdir 3237 error path C:\Program Files\nodejs\node_modules\.staging 3238 error errno -4048 3239 error Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging' 3239 error { [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'] 3239 error cause: 3239 error { Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging' 3239 error errno: -4048, 3239 error code: 'EPERM', 3239 error syscall: 'mkdir', 3239 error path: 'C:\\Program Files\\nodejs\\node_modules\\.staging' }, 3239 error stack: 3239 error 'Error: EPERM: operation not permitted, mkdir \'C:\\Program Files\\nodejs\\node_modules\\.staging\'', 3239 error errno: -4048, 3239 error code: 'EPERM', 3239 error syscall: 'mkdir', 3239 error path: 'C:\\Program Files\\nodejs\\node_modules\\.staging', 3239 error parent: 'nodemon' } 3240 error The operation was rejected by your operating system. 3240 error It's possible that the file was already in use (by a text editor or antivirus), 3240 error or that you lack permissions to access it. 3240 error 3240 error If you believe this might be a permissions issue, please double-check the 3240 error permissions of the file and its containing directories, or try running 3240 error the command again as root/Administrator. 3241 verbose exit [ -4048, true ]
-
chepe263 over 3 yearsescape the slashes and use double quotes
npm set prefix "%USERPROFILE%\\AppData\\Roaming\\npm"
-
kyselm over 2 yearsman, u saved me, after days of unsuccessful solutions read all over the internet, this one worked for me.thanks!