I was trying to install pngquant imagemin plugin using this command:
npm install imagemin-pngquant
... in Minimalist GNU for Windows running in Windows 10 64-bit OS. And I got this errors:
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "imagemin-mozjpeg"
npm ERR! node v4.1.2
npm ERR! npm v2.14.4
npm ERR! path C:\xampp\htdocs\node_modules\imagemin-mozjpeg\node_modules\mozjpeg\node_modules\logalot\node_modules\squeak\node_modules\lpad-align\node_modules\meow\node_modules\normalize-package-data\package.json.36eee2f8a596a53005b643f9a2de1c98
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\node_modules\imagemin-mozjpeg\node_modules\mozjpeg\node_modules\logalot\node_modules\squeak\node_modules\lpad-align\node_modules\meow\node_modules\normalize-package-data\package.json.36eee2f8a596a53005b643f9a2de1c98' -> 'C:\xampp\htdocs\node_modules\imagemin-mozjpeg\node_modules\mozjpeg\node_modules\logalot\node_modules\squeak\node_modules\lpad-align\node_modules\meow\node_modules\normalize-package-data\package.json'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\node_modules\imagemin-mozjpeg\node_modules\mozjpeg\node_modules\logalot\node_modules\squeak\node_modules\lpad-align\node_modules\meow\node_modules\normalize-package-data\package.json.36eee2f8a596a53005b643f9a2de1c98' -> 'C:\xampp\htdocs\node_modules\imagemin-mozjpeg\node_modules\mozjpeg\node_modules\logalot\node_modules\squeak\node_modules\lpad-align\node_modules\meow\node_modules\normalize-package-data\package.json']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\xampp\\htdocs\\node_modules\\imagemin-mozjpeg\\node_modules\\mozjpeg\\node_modules\\logalot\\node_modules\\squeak\\node_modules\\lpad-align\\node_modules\\meow\\node_modules\\normalize-package-data\\package.json.36eee2f8a596a53005b643f9a2de1c98',
npm ERR! dest: 'C:\\xampp\\htdocs\\node_modules\\imagemin-mozjpeg\\node_modules\\mozjpeg\\node_modules\\logalot\\node_modules\\squeak\\node_modules\\lpad-align\\node_modules\\meow\\node_modules\\normalize-package-data\\package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! C:\xampp\htdocs\npm-debug.log
I have tried to run the Minimalist GNU as Administrator but after several retries I still getting those errors. The errors gone after I disabled my anti-virus (Avast):
If you're still getting those errors after disabling your anti-virus for first run, try it to run for several times until you get it to install successfully.
Comments
Disable or uninstall MalwareBytes temporarily
You're welcome. Try to disable the MalwareBytes and execute your npm command but if still occurs try to uninstall MalwareBytes temporarily.
I spent hours trying all…
I spent hours trying all sorts of nonsense before finding this site in google search despair. Turning off MalwareBytes made it work instantly.
Thanks
Thanks for publishing this. Disabling MalwareBytes fixed my problem as well.
Thanks
Thank you very much for sharing this. I was repairing npm for a week, couldn't install anything and after reading this and disabling Malwarebytes it finally worked. Thank you again!
run as administrator
I ran command prompt as administrator, installed typescript@* --force and npm -i --force there. It worked for me
npm Err
run npm in console in 'Admin' mode …
Good tip! Thanks!
New antivirus in windows 10 security was blocking write permissions to the folder. In particular "Tamper Protection" seems to have been causing the issue on my install
Thanks!
Thanks! I was wondering what had gone wrong when I got this working on a project. Seems that MalwareBytes interferes with npm wanting to write files to the system i guess.