Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install error "Please try running this command again as root/Administrator."

I just upgrade my node into version v6.11.3 and the npm version is 5.4.1

I am trying to do

npm install 

or any npm install such as

npm install nodemon

and having this problem.

 npm WARN deprecated [email protected]: Please update to the latest version of pug, at time of writing that is [email protected]
 npm WARN deprecated [email protected]: Please use pug-load for pug-loader@<=1.0.2.
 npm ERR! path C:\Users\project\node_modules\fsevents\node_modules\aws-sign2\package.json
 npm ERR! code EPERM
 npm ERR! errno -4048
 npm ERR! syscall unlink
 npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\project\node_modules\fsevents\node_modules\aws-sign2\package.json'
 npm ERR!     at Error (native)
 npm ERR!  { Error: EPERM: operation not permitted, unlink 'C:\Users\project\node_modules\fsevents\node_modules\aws-sign2\package.json'
 npm ERR!     at Error (native)
 npm ERR!   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\project\\node_modules\\fsevents\\node_modules\\aws-sign2\\package.json\'\n    at Error (native)',

 npm ERR!   errno: -4048,
 npm ERR!   code: 'EPERM',
 npm ERR!   syscall: 'unlink',
 npm ERR!   path: 'C:\\Users\\project\\node_modules\\fsevents\\node_modules\\aws-sign2\\package.json' }
 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:\Program\_logs\2017-09-07T21_55_47_482Z-debug.log

I have been googling and trying a lot of different methods such as

 npm cache clean 

but having this problem

 npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify'
 instead.
 npm ERR!
 npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.

 npm ERR! A complete log of this run can be found in:
 npm ERR!     C:\Program\_logs\2017-09-07T22_03_49_893Z-debug.log

I am not sure how can I fix this problem and able to run my nodemon instead of nodemon bin/www

like image 878
Tenz Avatar asked Sep 07 '25 20:09

Tenz


1 Answers

Try using --no-optional while installing any package. That worked for me.
npm install nodemon --no-optional

like image 56
Umesh Saini Avatar answered Sep 09 '25 09:09

Umesh Saini