You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

创建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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.25 16:15:08