Issue
In order to Run Cypress in Jenkins, I have to run my React application first.
But when Jenkins is running the React application, it throws the following error:
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'
Error from chokidar (/data/node_modules/@emotion/unitless/dist): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@emotion/unitless/dist' Error from chokidar (/data/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime' Error from chokidar (/data/node_modules/@react-pdf/layout/lib/canvas): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@react-pdf/layout/lib/canvas' Error from chokidar (/data/node_modules/@react-pdf/layout/lib/page): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@react-pdf/layout/lib/page' Error from chokidar (/data/node_modules/@react-pdf/layout/lib/utils): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@react-pdf/layout/lib/utils' Error from chokidar (/data/node_modules/@react-pdf/render/lib): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@react-pdf/render/lib' Error from chokidar (/data/node_modules/@react-pdf/render/lib/utils): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@react-pdf/render/lib/utils' Error from chokidar (/data/node_modules/@react-pdf/stylesheet/lib): Error: ENOSPC: System limit for number of file watchers reached, watch '/data/node_modules/@react-pdf/stylesheet/lib'
So it has been impossible to run the App in Jenkins.
This is the Stage in the Jenkins file that throws the error:
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
'''
}
}
}
And this is the script in the package.json file that it's running:
"start:e2e-ci": "REACT_APP_TEST_ENV=e2e HTTPS=true HOST=pressboxlivelocal.statsperform.com PORT=443 react-scripts start"
Solution
Try adding this env as well CHOKIDAR_USEPOLLING=1
to your start:e2e:-ci
script
Answered By - mosaad