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

Angular 8在Jenkins构建报RangeError最大调用栈溢出本地无法复现求助

问题描述

我在Jenkins上构建Angular 8项目时遇到报错,该问题仅在Jenkins环境出现,本地构建无法复现,暂无法排查问题根因。
报错信息如下:

RangeError: Maximum call stack size exceeded
 at RegExp.test (<anonymous>)
 at Module.removeExistingSourceMap (/xxxxxx/node_modules/rollup/dist/rollup.js:13859:56)
 at Module.setSource (/xxxxxx/node_modules/rollup/dist/rollup.js:13640:14)
 at Promise.resolve.catch.then.then.then  (/xxxxxx/node_modules/rollup/dist/rollup.js:16423:20)
排查解决思路
  • 核对Jenkins构建环境和本地环境的依赖版本:确认Node.js、npm/yarn版本完全一致,版本差异会导致依赖安装结果不同,触发rollup处理逻辑异常。
  • 清理Jenkins构建缓存:每次构建前执行npm cache clean --force,删除工作空间内的旧node_modules目录、package-lock.json/yarn.lock文件,重新执行依赖安装操作,避免缓存的损坏依赖包触发问题。
  • 调整sourcemap配置:临时关闭angular.json中的sourceMap构建配置后重新构建,验证是否是sourcemap处理逻辑中递归调用导致栈溢出。
  • 调整Node运行参数:在Jenkins构建脚本中增加Node栈大小配置,例如执行构建时使用命令node --stack-size=2048 ./node_modules/@angular/cli/bin/ng build,规避默认栈大小不足触发的溢出问题。
  • 锁定rollup稳定版本:若当前使用的rollup版本存在已知的sourcemap处理递归bug时,可在package.json的resolutions字段中指定稳定兼容的rollup版本,重新安装依赖后构建测试。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.06 17:06:05