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.

react-scripts start should support CI=true, watchAll=false etc.

See original GitHub issue

Is your proposal related to a problem?

I’m running react-scripts start in a CI environment in order to run cypress end-to-end tests. As the project has grown this has started hitting the inotify.max_user_instances kernel limit which cannot be configured from within a container, this is reported as:

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: watch /path/to/somewhere ENOSPC
    at FSWatcher.start (fs.js:1382:19)
    at Object.fs.watch (fs.js:1408:11)
    at createFsWatchInstance (/path/to/somewhere

Describe the solution you’d like

react-scripts start should support flags already used with react-scripts test that turn off webpack’s file watching, these include env var CI and commandline flags --watchAll=false

Describe alternatives you’ve considered

I could use my production express server or something else to serve these files, but these aren’t dependencies of the app whereas it’s already using webpack-dev-server with configurable watch options.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:25
  • Comments:7

github_iconTop GitHub Comments

2reactions
jiaming10commented, Feb 18, 2020

I have a similar-but-not-too-similar use case. I’m currently running VSCode Remote Containers, and react-scripts start will hit inotify.max_user_instances in the container I’m using.

I can get around this is by setting the parameter on my host, or another way to get around is to spin up another docker(nginx, apache, etc…).

So yeah, an option to disable watching node_modules/ will be good.

0reactions
amberisvibincommented, Nov 27, 2022

+1 This would be very nice, I’ve hit the inotify.max_user_instances limit as well. Increasing the limit worked, but wasn’t ideal in the least. I ended up fixing this in Webpack by adding a webpack.config.js file with the following:

module.exports = {
  watchOptions: {
    ignored: /node_modules/,
  },
};

This prevents webpack from watching every file in the node_modules directory. It would be appreciated if this was an option in create-react-app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run Create-React-App Tests not in Watch Mode
So for example you can create another script like this: "scripts": { "test:nowatch": "react-scripts test --watchAll=false", }. And then run
Read more >
Running Tests | Create React App
*Although we recommend running your tests in watch mode during development, you can disable this behavior by passing in the --watchAll=false ...
Read more >
How to set up SonarQube locally on a React TypeScript Project
Let me explain some command options that we've added: --watchAll=false: It is because when executing 'test' script, React will start a watch- ...
Read more >
React deploy and test with Azure DevOps - Medium
To start we need to create a free account in the Azure ... ci:unit: npm run test --watchAll=false and will be something like...
Read more >
STOP Using Create React App - YouTube
Create React App is a plague and we're here to cure it. Please use Vite, NextJS, or Remix instead. Seriously, anything is better...
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