安装@angular/cli@14.2.5遇npm错误,重装Node.js无效求解决
解决npm安装@angular/cli@14.2.5时的"Cannot read properties of null (reading 'edgesOut')"错误
错误详情
执行全局安装命令时触发错误:
C:\FATIH\angular_text>npm i -g @angular/cli@14.2.5 npm error Cannot read properties of null (reading 'edgesOut') npm error A complete log of this run can be found in: C:\Users\FATİH\AppData\Local\npm-cache\_logs\2024-08-04T22_46_12_043Z-debug-0.log
已尝试卸载重装Node.js,问题仍未解决,需完成安装并能通过npm list查看已安装包。
解决方案
强制清理npm缓存
先执行命令清理缓存:npm cache clean --force再手动删除缓存目录:
C:\Users\FATİH\AppData\Local\npm-cache匹配兼容的npm版本
Angular CLI 14.2.5与npm 6.x/8.x兼容性更好,建议通过Node版本管理器(nvm)切换到Node.js 16.x(默认配套npm 8.x),再重新执行安装命令:npm i -g @angular/cli@14.2.5以管理员权限运行命令行
右键打开命令提示符/PowerShell,选择「以管理员身份运行」,再执行安装命令,规避权限引发的缓存异常。重置npm配置
执行以下命令重置默认配置,排除代理或镜像源问题:npm config delete proxy npm config delete https-proxy npm config set registry https://registry.npmjs.org/
验证安装
完成后执行以下命令确认:
ng version npm list -g --depth=0
内容的提问来源于stack exchange,提问作者Fatih Güneş
相关产品推荐
相关产品推荐

