Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Npm ERR! code EPERM

I'm using node v6.11.2, npm v5.3.0 and angular/cli v1.2.7.

I'm suddenly receiving the following error message for a majority of my npm installs. Never seen it before...

mmeppiel@MC-LT-MMEPPIEL MINGW64 ~/Desktop/Angular Solutions/my-app (master) $ npm install --save [email protected] font-awesome npm ERR! path C:\Users\mmeppiel\Desktop\Angular Solutions\my-app\node_modules\fs                            events\node_modules npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall lstat npm ERR! Error: EPERM: operation not permitted, lstat 'C:\Users\mmeppiel\Desktop                            \Angular Solutions\my-app\node_modules\fsevents\node_modules' npm ERR!     at Error (native) npm ERR!  { Error: EPERM: operation not permitted, lstat 'C:\Users\mmeppiel\Desk                            top\Angular Solutions\my-app\node_modules\fsevents\node_modules' npm ERR!     at Error (native) npm ERR!   stack: 'Error: EPERM: operation not permitted, lstat \'C:\\Users\\mme                            ppiel\\Desktop\\Angular Solutions\\my-app\\node_modules\\fsevents\\node_modules\                            '\n    at Error (native)', npm ERR!   errno: -4048, npm ERR!   code: 'EPERM', npm ERR!   syscall: 'lstat', npm ERR!   path: 'C:\\Users\\mmeppiel\\Desktop\\Angular Solutions\\my-app\\node_                            modules\\fsevents\\node_modules' } npm ERR! npm ERR! Please try running this command again as root/Administrator.  npm ERR! A complete log of this run can be found in: npm ERR!     C:\Users\mmeppiel\AppData\Roaming\npm-cache\_logs\2017-08-08T00_56_                            59_442Z-debug.log 

Can anyone explain what's going on here? Things I've tried:

  • Running Git Bash as an administrator
  • Turning off my firewall and AntiVirus protections
  • Running npm cache clean
  • Manually deleting the contest of AppData\Roaming\npm-cache
  • Uninstalling node via the Control Panel and reinstalling
  • Gave Everyone full permissions to C:\Program Files\nodejs
  • Reinstalled the CLI
  • Restarted my computer (can't hurt?)
  • Made sure the node_modules folder is not read only

Appreciate your time!

like image 671
Matthew Meppiel Avatar asked Aug 08 '17 01:08

Matthew Meppiel


People also ask

What is Eperm?

POSIX defines EACCES as " an attempt was made to access a file in a way forbidden by its file access permissions " and EPERM as " an attempt was made to perform an operation limited to processes with appropriate privileges or to the owner of a file or other resource ".


Video Answer


2 Answers

I get this error when running Visual Studio Code because the typescript compiler watches files and locks them (see https://github.com/Microsoft/vscode/issues/28593). The solution is to temporarily close VS Code when dealing with NPM. Perhaps you have something watching files?

like image 166
James Ehly Avatar answered Sep 23 '22 00:09

James Ehly


Are you using any private or company registry. check your .npmrc file and make sure its available.

if you are in company environment, make sure proxy is not a problem.

check in your folder if any package-lock.json is generated. you can delete that make re install.

I have little doubt but node 6.x.x with npm 5.x.x might be a problem as node 7.x.x is compatible arable with 5.x.x. And normally node 6.x.x is compatible with npm 4.x.x

like image 23
Aniruddha Das Avatar answered Sep 22 '22 00:09

Aniruddha Das