【npm 报错】 WARN logfile could not be created 怎么解决

先来下报错内容:

npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_logs\2022-07-21T09_43_50_743Z-debug-0.log'
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_logs\2022-07-21T09_43_51_174Z-debug-0.log'

起因:使用npm安装cnpm工具,刚配置完prefix和cache,但是执行

npm install -g cnpm --registry=https://registry.npm.taobao.org

代码段时报错,搜索后发现是由于命令行工具cmd并非管理员模式,使用npm命令时不能使用管理员权限写入log到nodejs目录下

解决方法:

 

两个文件夹中user用户组授予权限即可解决

猜你喜欢

转载自blog.csdn.net/weixin_56170314/article/details/125917683
今日推荐