github-action icon indicating copy to clipboard operation
github-action copied to clipboard

ENOSPC: System limit for number of file watchers reached

Open charklewis opened this issue 4 years ago • 3 comments

I have found that when I start my create-react-app using yarn start the server starts as expected, however then immediately errors almost every file with ENOSPC: System limit for number of file watchers reached. I have managed to fix this by adding the below step to my yaml file (I found this solution here).

- name: Setup kernel for react, increase watchers
        run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Is there are another a better approach to solve this?

charklewis avatar Apr 23 '21 12:04 charklewis

Thanks for adding a solution @charklewis! I also ran into this issue and the solution seems to work for me. It would be good to at least mention it in the documentation here.

lizraeli avatar Jun 10 '21 14:06 lizraeli

Unfortunately this solution is somehow not working for me. I get the following error:

Run echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
/__w/_temp/84726bfa-c8c8-4827-84e7-1288541db1df.sh: 1: /__w/_temp/84726bfa-c8c8-4827-84e7-1288541db1df.sh: sudo: not found
Error: Process completed with exit code 127.

My workflow:

  chrome:
    name: Chrome
    timeout-minutes: 15
    runs-on: ubuntu-latest
    container: cypress/browsers:node14.15.0-chrome86-ff82
    needs: build
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2

      - name: Increase File Watchers 🔭
        run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

		# other steps ...

I'm using the normal hosted runners in the latest version. Anyone maybe knows how to solve this issue? Could it be because I use a container?

EDIT: I confirmed it: It works all fine without the docker container, opened an issue in their repo: https://github.com/cypress-io/cypress-docker-images/issues/505

Related: #317

panmona avatar Jun 20 '21 09:06 panmona

Unfortunately this solution is somehow not working for me. I get the following error:

Run echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
/__w/_temp/84726bfa-c8c8-4827-84e7-1288541db1df.sh: 1: /__w/_temp/84726bfa-c8c8-4827-84e7-1288541db1df.sh: sudo: not found
Error: Process completed with exit code 127.

My workflow:

  chrome:
    name: Chrome
    timeout-minutes: 15
    runs-on: ubuntu-latest
    container: cypress/browsers:node14.15.0-chrome86-ff82
    needs: build
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2

      - name: Increase File Watchers 🔭
        run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

		# other steps ...

I'm using the normal hosted runners in the latest version. Anyone maybe knows how to solve this issue? Could it be because I use a container?

EDIT: I confirmed it: It works all fine without the docker container, opened an issue in their repo: cypress-io/cypress-docker-images#505

Related: #317

This worked for me! Not seeing the error anymore:

      - uses: actions/checkout@v2
      - name: Increase file watchers
        run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
      - name: Run Component tests
        uses: cypress-io/github-action@v2
        with:
          command: npx cypress run-ct

FelipeLahti avatar Sep 14 '21 21:09 FelipeLahti

Closing

  • A workaround has been shared
  • This is not an issue with github-action
  • CRA appears to be now unsupported. See https://github.com/facebook/create-react-app/issues/13393

MikeMcC399 avatar Nov 04 '23 10:11 MikeMcC399