nhandled rejection Error: EPERM: operation not permitted, open 'C:Program Files odejs ode_cache npm ERR! cb() never called!

安装全局包时报错,之前已经遇到过,结果第二次又忘记解决方法,果然还是要记下来,好记性不如烂笔头哇

$ npm i electron -g
Unhandled rejection Error: EPERM: operation not permitted, open 'C:Program Files odejs ode_cache\_cacache mpf23044b6'
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>

这个错误是因为没有管理员权限,解决方法,右键点击开始菜单,选择以管理员身份运行,在打开的黑窗再继续安装就可以

OK,安装成功

原文地址:https://www.cnblogs.com/steamed-twisted-roll/p/11628263.html