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

删除node_modules后执行npm install出现ERESOLVE依赖冲突错误求助

解决npm ERESOLVE依赖冲突问题

问题核心

项目中安装的esbuild@0.15.10与@badeball/cypress-cucumber-preprocessor@11.4.0要求的esbuild@^0.14.23版本冲突,而@bahmutov/cypress-esbuild-preprocessor@2.1.5支持任意版本的esbuild。

方案1:统一esbuild版本到兼容范围(推荐)

  1. 修改项目根目录下的package.json文件:
    在devDependencies中,将"esbuild": "^0.15.10"替换为"esbuild": "^0.14.54"(该版本为0.14.x分支的最新稳定版,满足依赖要求)
  2. 清理旧依赖和锁文件,重新安装:
    rm -rf node_modules package-lock.json
    npm install
    

方案2:升级@badeball/cypress-cucumber-preprocessor到兼容版本

更高版本的@badeball/cypress-cucumber-preprocessor已支持esbuild 0.15.x,直接升级即可:

  1. 执行升级命令:
    npm install @badeball/cypress-cucumber-preprocessor@latest --save
    
    (若需指定具体版本,可选择12.x及以上版本,例如@12.0.0)
  2. 清理旧依赖和锁文件,重新安装:
    rm -rf node_modules package-lock.json
    npm install
    

方案3:使用npm兼容模式(临时应急)

若暂时无法修改版本,可通过npm参数跳过peer依赖检查,但可能导致依赖树不稳定:

  • 使用--legacy-peer-deps参数(推荐临时使用):
    npm install --legacy-peer-deps
    
  • 或使用--force参数(更激进,风险更高):
    npm install --force
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 21:45:37