Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm ERR! Error: EPERM: operation not permitted

Running from a Windows Powershell as Administrator, I have tried all of the below. Nothing works. Not only that, it takes like 20 minutes to get to the error.

  • Upgrading node
  • Upgradeing npm
  • Turning off AntiVirus
  • Cleaning the mpm cache
  • Verifying the npm cache

Here is the output from trying to create a project:

PS D:\Documents\js> create-react-app socket-io-client

Creating a new React app in D:\Documents\js\socket-io-client.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...


> [email protected] postinstall D:\Documents\js\socket-io-client\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

npm ERR! path D:\Documents\js\socket-io-client\node_modules\fsevents\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rmdir
npm ERR! Error: EPERM: operation not permitted, rmdir 'D:\Documents\js\socket-io-client\node_modules\fsevents\node_modules'
npm ERR!  { Error: EPERM: operation not permitted, rmdir 'D:\Documents\js\socket-io-client\node_modules\fsevents\node_modules'
npm ERR!   stack: 'Error: EPERM: operation not permitted, rmdir \'D:\\Documents\\js\\socket-io-client\\node_modules\\fsevents\\node_modules\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rmdir',
npm ERR!   path: 'D:\\Documents\\js\\socket-io-client\\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\idf\AppData\Roaming\npm-cache\_logs\2017-08-15T04_50_32_705Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting generated file... node_modules
like image 299
Ivan Avatar asked Jan 30 '23 19:01

Ivan


1 Answers

I know you have resolved your issue. But in case somebody else got the same error message, what ended up working for me was deleting these folders.

C:\Users\[username]\AppData\Roaming\npm
C:\Users\[username]\AppData\Roaming\npm-cache

If the problem still persists, try one of the fixes from this thread: https://github.com/npm/npm/issues/10826.

like image 172
Karn Ratana Avatar answered Feb 02 '23 05:02

Karn Ratana