【发布时间】:2021-11-08 19:07:38
【问题描述】:
为了在 Jenkins 中运行 Cypress,我必须先运行我的 React 应用程序。
但是当 Jenkins 运行 React 应用程序时,它会抛出以下错误:
Error from chokidar (/data/node_modules/@babel/runtime/regenerator): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@babel/runtime/regenerator'
来自 chokidar (/data/node_modules/@emotion/unitless/dist) 的错误:错误:ENOSPC:已达到文件观察者数量的系统限制,请观看“/data/node_modules/@emotion/unitless/dist” 来自 chokidar 的错误(/data/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime):错误:ENOSPC:已达到文件观察者数量的系统限制,请观看 '/data/node_modules/@pmmmwh/react-刷新-webpack-plugin/lib/runtime' 来自 chokidar 的错误(/data/node_modules/@react-pdf/layout/lib/canvas):错误:ENOSPC:已达到文件观察者数量的系统限制,请观看 '/data/node_modules/@react-pdf/layout/lib/帆布' 来自 chokidar 的错误(/data/node_modules/@react-pdf/layout/lib/page):错误:ENOSPC:达到文件观察者数量的系统限制,观看'/data/node_modules/@react-pdf/layout/lib/页' 来自 chokidar 的错误(/data/node_modules/@react-pdf/layout/lib/utils):错误:ENOSPC:已达到文件观察者数量的系统限制,请观看 '/data/node_modules/@react-pdf/layout/lib/实用程序' 来自 chokidar 的错误(/data/node_modules/@react-pdf/render/lib):错误:ENOSPC:已达到文件观察者数量的系统限制,请观看“/data/node_modules/@react-pdf/render/lib” 来自 chokidar 的错误(/data/node_modules/@react-pdf/render/lib/utils):错误:ENOSPC:达到文件观察者数量的系统限制,观看'/data/node_modules/@react-pdf/render/lib/实用程序' 来自 chokidar 的错误(/data/node_modules/@react-pdf/stylesheet/lib):错误:ENOSPC:已达到文件观察者数量的系统限制,请观看“/data/node_modules/@react-pdf/stylesheet/lib”
所以在 Jenkins 中运行 App 是不可能的。
这是 Jenkins 文件中引发错误的阶段:
stage('Cypress') {
steps {
configFileProvider([configFile(fileId: 'shell-aliases', variable: 'CFG_SHELL_ALIASES')]) {
sh '''
source $CFG_SHELL_ALIASES > /dev/null 2>&1
npm run start:e2e-ci
'''
}
}
}
这是它正在运行的 package.json 文件中的脚本:
"start:e2e-ci": "REACT_APP_TEST_ENV=e2e HTTPS=true HOST=pressboxlivelocal.statsperform.com PORT=443 react-scripts start"
【问题讨论】: