【问题标题】:How can I run my React Application in Jenkins before running Cypress?在运行 Cypress 之前,如何在 Jenkins 中运行我的 React 应用程序?
【发布时间】: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"

【问题讨论】:

    标签: reactjs jenkins cypress


    【解决方案1】:

    尝试将此环境也添加到 CHOKIDAR_USEPOLLING=1 到您的 start:e2e:-ci 脚本中

    【讨论】:

    • 它工作得非常好。非常感谢。
    猜你喜欢
    • 2018-07-27
    • 1970-01-01
    • 2023-01-12
    • 2018-09-09
    • 1970-01-01
    • 1970-01-01
    • 2020-07-30
    • 2022-07-19
    • 2015-08-30
    相关资源
    最近更新 更多