创建React应用时npm报错Cannot read properties of null (reading 'pickAlgorithm')
npm ERR! Cannot read properties of null (reading 'pickAlgorithm')
npm ERR! 本次运行的完整日志可在以下路径查看:
C:\Users\Nagamanickam\AppData\Local\npm-cache_logs\2021-11-18T12_01_45_525Z-debug.log
解决方法
该报错通常由npm本地缓存损坏导致,可按以下步骤处理:
- 强制清理npm缓存
执行命令:npm cache clear --force - 清理完成后重新运行React应用创建命令即可,命令中替换为你自己的项目名称:
npx create-react-app <你的项目名称>
备选处理方案
如果上述方法无效,可尝试以下操作:
- 升级npm到最新稳定版本后重试
执行命令:npm install -g npm@latest - 切换使用yarn创建项目
先全局安装yarn:npm install -g yarn
再执行创建命令,替换为你自己的项目名称:yarn create react-app <你的项目名称>
内容的提问来源于stack exchange,提问作者Nagamanickam
相关产品推荐
相关产品推荐

