0

PS C:\New folder> npm install -g yo generator-code
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\generator-code
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\generator-code'
npm ERR!  [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\generator-code'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'C:\\Program Files\\nodejs\\node_modules\\generator-code'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Forever\AppData\Local\npm-cache\_logs\2020-11-25T04_10_40_095Z-debug.log

when I tried to install npm install -g yo generator-code its showing this error . i have run it three times 2 on windows 1 on Linux but everytime its showing this error how can i fix it

1 Answers1

1

Its a permission issue

i would recommned you configure npm to not require sudo/Admin permission to install global packages.

for now just downgrade your npm version or run your cmd with 'Admin privileges'.

if these steps doesn't help

then run this npm cache clean --force and then try reinstalling your package.

Jatin Mehrotra
  • 9,286
  • 4
  • 28
  • 67
  • 1
    thank you so much i have been trying to solve it for 2 days and this is my first question on stackoverflow i have tried you suggestions 1 by one and run it again and its working now thank you 10000.. times o(*°▽°*)o – Maqsudbek Tolipov Nov 25 '20 at 04:46