Reputation: 419
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 ]
Upvotes: 12
Views: 41900
Reputation: 1
I solve this issue...
Firstly you change your drive c drive change make new drive D and then run your command
D:\nodejs> vue create hello-world
this is what worked for me
Upvotes: 0
Reputation: 211
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
Upvotes: 21
Reputation: 121
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.
Upvotes: 2
Reputation: 75
Today we ran into the same problem. It turned out that there was a environment variable set:
NPM_CONFIG_PREFIX=C:\Program Files\Nodejs
Removing this environment variable fixed the problem fo us.
Upvotes: 0
Reputation: 805
Run
npm cache clear
npm install npm -g
If you run the command npm cache clear get error, it means you don't have npm installed yet, just run the following command: npm install npm -g Then close command prompt or visual studio code and run it again to take effect
Upvotes: 0
Reputation: 71
on windows 10 👍
From Start Menu : type "CMD" then "run as administrator" then continue using "Node Commands"
Upvotes: 2
Reputation: 87
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
Upvotes: 7
Reputation: 189
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.
Upvotes: 3