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

执行npm start启动React应用时遇Cannot read properties of undefined错误

React应用npm start报错:Cannot read properties of undefined (reading 'stdin')

问题详情

执行npm start启动React应用时触发错误,报错信息如下:

saksh@DELL MINGW64
$ npm start

sakshee@0.1.0 start
react-scripts start

npm ERR! Cannot read properties of undefined (reading 'stdin')

npm ERR! A complete log of this run can be found in

已尝试重新安装Node.js和node_modules,问题未解决。相关package.json截图:
package.json

可行解决方案

  • 切换终端环境:避免在IDE内置终端运行,改用系统原生终端(Windows用CMD/PowerShell,Mac/Linux用Terminal)重新执行npm start。
  • 清理npm缓存并重装依赖:
    npm cache clean --force
    rm -rf node_modules package-lock.json # Windows系统替换为:rmdir /s /q node_modules && del package-lock.json
    npm install
    npm start
    
  • 更新react-scripts到最新版:
    npm install react-scripts@latest
    npm start
    
  • 验证Node.js版本:确保使用的Node.js版本与react-scripts兼容(推荐LTS版本如18.x、20.x),版本不匹配则借助nvm/nvm-windows切换对应版本。
  • 尝试用yarn启动:
    npm install -g yarn
    yarn install
    yarn start
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 21:42:35