Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm - Error: EPERM: operation not permitted, unlink [duplicate]

Windows 10 1703
Node 6.11.2
npm 5.4.0

Everytime I try to install an npm package (ex: npm i gulp-notify), I receive the following error:


npm ERR! path C:\Users\web-dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\web-
dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json' npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\web-dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native)
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'C:\Users\web-dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json\'\n at Error (native)',
npm ERR! errno: -4048,
npm ERR!
code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR!
path: 'C:\Users\web-dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json' }
npm ERR! npm ERR! Please try running this command again as root/Administrator.


I ran cmd as administrator
I checked folder permissions
I cleared cache even though npm says it does it by itself
I changed npm prefix to C:\Users\User Name\AppData\Roaming\npm
Nothing helps.

Please advise.

like image 918
Serhii Borovskyi Avatar asked Sep 03 '17 09:09

Serhii Borovskyi


1 Answers

Apparently I was trying to install packages locally instead of globally without the -g flag. Sorry about that. All is working now.

like image 61
Serhii Borovskyi Avatar answered Oct 10 '22 22:10

Serhii Borovskyi