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

安装React时遭遇严重阻碍,求助解决jest-worker报错问题

解决jest-worker模块编译错误的步骤

错误详情

/node_modules/react-scripts/node_modules/eslint-webpack-plugin/node_modules/jest-worker/build/index.js:110
_ending;
^

已尝试彻底删除并重装npm、node等相关组件,但错误仍反复出现。

具体解决步骤

  • 清理npm缓存:
    npm cache clean --force
    
  • 删除项目根目录下的node_modules文件夹以及package-lock.json(使用yarn则删除yarn.lock)
  • 手动删除嵌套的有问题的jest-worker依赖目录:
    • macOS/Linux:
      rm -rf node_modules/react-scripts/node_modules/eslint-webpack-plugin/node_modules/jest-worker
      
    • Windows:
      rmdir /s /q node_modules\react-scripts\node_modules\eslint-webpack-plugin\node_modules\jest-worker
      
  • 重新执行依赖安装:
    npm install
    
  • 如果以上步骤无效,尝试升级react-scripts到最新版本:
    npm install react-scripts@latest
    
  • 最后检查Node.js版本是否为LTS版本(推荐16.x/18.x),版本不兼容也可能导致这类依赖编译问题

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.19 15:48:12