為了在 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-refresh-webpack-plugin/來自 chokidar (/data/node_modules/@react-pdf/layout/lib/canvas) 的 lib/runtime' 錯誤:錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀看 '/data/node_modules/@react-pdf/ layout/lib/canvas' 來自 chokidar (/data/node_modules/@react-pdf/layout/lib/page) 的錯誤:錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀看 '/data/node_modules/@react- pdf/布局/lib/頁面'來自 chokidar 的錯誤(/data/node_modules/@react-pdf/layout/lib/utils):錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀察'/data/node_modules/@react-pdf/layout/lib/來自 chokidar 的 utils 錯誤(/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) 的 utils 錯誤:錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀看 '/data/node_modules/@react-pdf/stylesheet/lib'達到檔案觀察器數量的系統限制,觀察 '/data/node_modules/@react-pdf/layout/lib/utils' 來自 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/utils' 來自 chokidar 的錯誤 (/data/node_modules/@react-pdf/stylesheet/lib):錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀察'/data/node_modules/@react-pdf/stylesheet/lib'達到檔案觀察器數量的系統限制,觀察 '/data/node_modules/@react-pdf/layout/lib/utils' 來自 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/utils' 來自 chokidar 的錯誤 (/data/node_modules/@react-pdf/stylesheet/lib):錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀察'/data/node_modules/@react-pdf/stylesheet/lib'達到檔案觀察器數量的系統限制,觀察 '/data/node_modules/@react-pdf/render/lib' 來自 chokidar 的錯誤 (/data/node_modules/@react-pdf/render/lib/utils):錯誤:ENOSPC:達到檔案觀察器數量的系統限制,觀察 '/data/node_modules/@react-pdf/render/lib/utils' 來自 chokidar 的錯誤 (/data/node_modules/@react-pdf/stylesheet/lib):錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀察'/data/node_modules/@react-pdf/stylesheet/lib'達到檔案觀察器數量的系統限制,觀察 '/data/node_modules/@react-pdf/render/lib' 來自 chokidar 的錯誤 (/data/node_modules/@react-pdf/render/lib/utils):錯誤:ENOSPC:達到檔案觀察器數量的系統限制,觀察 '/data/node_modules/@react-pdf/render/lib/utils' 來自 chokidar 的錯誤 (/data/node_modules/@react-pdf/stylesheet/lib):錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀察'/data/node_modules/@react-pdf/stylesheet/lib'錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀察'/data/node_modules/@react-pdf/stylesheet/lib'錯誤:ENOSPC:達到檔案觀察者數量的系統限制,觀察'/data/node_modules/@react-pdf/stylesheet/lib'
所以一直無法在Jenkins中運行該應用程式。
這是 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"
uj5u.com熱心網友回復:
嘗試將此環境也添加CHOKIDAR_USEPOLLING=1 到您的start:e2e:-ci腳本中
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/353357.html
