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

React教程中执行npx create-react-app报错‘Cannot find module block-stream’求助

解决npx create-react-app提示“Cannot find module 'block-stream'”的问题
  • 清除npm缓存
    执行命令清理可能损坏的缓存文件:

    npm cache clean --force
    
  • 卸载并重新全局安装create-react-app
    高版本npm与旧版create-react-app可能存在兼容问题,重新安装适配版本:

    npm uninstall -g create-react-app
    npm install -g create-react-app
    
  • 指定特定版本创建项目
    尝试使用与教程发布时间(2021年1月)匹配的稳定版本(如4.0.3)创建项目:

    npx create-react-app@4.0.3 你的项目名称
    
  • 手动安装缺失的block-stream模块
    临时补充缺失的依赖模块后再尝试创建:

    npm install -g block-stream
    npx create-react-app 你的项目名称
    
  • 切换npm官方源(可选)
    如果使用第三方镜像源出现包同步问题,切换回官方源:

    npm config set registry https://registry.npmjs.org/
    

内容的提问来源于stack exchange,提问作者Nate

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 09:49:54