Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging

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 ]
like image 727
venu kumar Avatar asked Sep 24 '19 11:09

venu kumar


People also ask

How do I fix Eperm Operation not permitted?

Find powerShell/cmd in the desktop search bar, right click and choose to run as an administrator, and then use the cd command to go to the folder where you need to perform npm install and run it again to solve the problem.


5 Answers

Try clearing the cache:

  • npm cache clean --force

Or

  1. npm uninstall npm -g
  2. npm install npm -g

Or

  • npm set prefix 'C:\Users\User\AppData\Roaming\npm'

The last one worked for me

like image 84
Alexander Chinyan Avatar answered Oct 23 '22 08:10

Alexander Chinyan


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
like image 20
Mohammad Jouza Avatar answered Oct 23 '22 08:10

Mohammad Jouza


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.

like image 21
Stephen Mwangi Wanjohi Avatar answered Oct 23 '22 09:10

Stephen Mwangi Wanjohi


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.

like image 37
Sunny Jha Avatar answered Oct 23 '22 08:10

Sunny Jha


on windows 10 👍

From Start Menu : type "CMD" then "run as administrator" then continue using "Node Commands"

like image 29
Mohammed Kadi Avatar answered Oct 23 '22 10:10

Mohammed Kadi