question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress 10.3.1: System limit for number of file watchers reached

See original GitHub issue

Current behavior

Hello, I’m trying to run Cypress in GitLab CI using the cypress/base:16 image.

I run my tests with the following command:

cypress run --headless --component --config watchForFileChanges=false

Additionally I have disabled file watching in vite.config.js, however I’m getting the following error on every run:

  (Run Starting)
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Cypress:        10.3.1                                                                         β”‚
  β”‚ Browser:        Electron 100 (headless)                                                        β”‚
  β”‚ Node Version:   v16.14.2 (/usr/local/bin/node)                                                 β”‚
  β”‚ Specs:          21 found (app-banner.cy.js, todo.cy.js, actions.cy.js, aliasing.cy.js, asserti β”‚
  β”‚                 ons.cy.js, connectors.cy.js, cookies.cy.js, cypress_api.cy.js, files.cy.js, lo β”‚
  β”‚                 cal_storage.cy.js, location.cy.js, misc.cy.js, navigation.cy.js, network_reque β”‚
  β”‚                 sts.cy.js, querying.cy....)                                                    β”‚
  β”‚ Searched:       **/*.cy.{js,jsx,ts,tsx}                                                        β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  app-banner.cy.js                                                               (1 of 21)
Your configFile threw an error from: cypress.config.js
We stopped running your tests because your config file crashed.
Error: ENOSPC: System limit for number of file watchers reached, watch '/builds/technical-design/ripe-app-webcomponents/cache/Cypress/10.3.1/Cypress/resources/app/packages/data-context/src/codegen/index.js'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2251:34)
    at createFsWatchInstance (file:///builds/technical-design/ripe-app-webcomponents/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:47466:17)
    at setFsWatchListener (file:///builds/technical-design/ripe-app-webcomponents/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:47513:15)
    at NodeFsHandler$1._watchWithNodeFs (file:///builds/technical-design/ripe-app-webcomponents/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:47668:14)
    at NodeFsHandler$1._handleFile (file:///builds/technical-design/ripe-app-webcomponents/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:47732:23)
    at NodeFsHandler$1._addToNodeFs (file:///builds/technical-design/ripe-app-webcomponents/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:47974:21)

This is similar to #22054 and #17173 for example

Desired behavior

Not throw an error and disable file watching

Test code to reproduce

I might get around to this later

Cypress Version

10.3.1

Other

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
TommasoAmicicommented, Aug 10, 2022

Thanks for the tip, but as explained above, I already found a workaround

Following this suggestion #17173 (comment), I have added CHOKIDAR_USEPOLLING=1 to my environment and it works

However my understanding is that file watching should be disabled if I pass --config watchForFileChanges=false so this shouldn’t be happening at all.

Is it possible that this option is not being picked up by Cypress?

1reaction
AtofStrykercommented, Aug 10, 2022

Thanks for the tip, but as explained above, I already found a workaround

Following this suggestion #17173 (comment), I have added CHOKIDAR_USEPOLLING=1 to my environment and it works

Oh yeah that’s right 🀦🏻 . Sorry about that!

However my understanding is that file watching should be disabled if I pass --config watchForFileChanges=false so this shouldn’t be happening at all.

Is it possible that this option is not being picked up by Cypress?

Definitely possible. I’ll give https://github.com/TommasoAmici/cypress-repro-23061 a clone and do some debugging to see what’s going on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress crashing on Linux > System limit for number of file ...
Hi, daily user of Cypress here. Just found this corner case where Cypress.js is crashing. Steps to reproduce Not exactly sure but overallΒ ......
Read more >
React Native Error: ENOSPC: System limit for number of file ...
Each file watch takes up 540 bytes (32-bit) or ~1kB (64-bit), so assuming that all 524,288 watches are consumed, that results in an...
Read more >
Changelog - Cypress Documentation
10.3.1. Released 7/19/2022. Bugfixes: Fixed an issue where file watchers were not completely closed prior to the Cypress App quitting, causing crashes onΒ ......
Read more >
Error: ENOSPC: System limit for number of file watchers reached
The pipeline has steps when it runs UI tests using Cypress. Recently we upgraded Cypress from 7.3.0 to 7.7.0 and new issue about...
Read more >
node:internal/fs/watchers:252 throw error; - You.com | The AI ...
I am totally new in React/nodjs world, but I am struggling with it for couple of days. I have installed node-v13.50.0-x64 Then I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found