Create-react-app: react-scripts start does not work with lerna run --parallel --stream

Created on 21 Mar 2020  路  12Comments  路  Source: facebook/create-react-app

Since react-scripts 3.4.1
On macos 10.15.3 (not tested elsewhere)

running the command :

yarn lerna run --parallel --stream start

does not start the webpack dev server.

If i remove all lerna arguments it works :

yarn lerna run start
bug report needs investigation needs triage

Most helpful comment

I have the same issue need rollback to v3.4.0 currently.

All 12 comments

I have the same issue need rollback to v3.4.0 currently.

From what I can tell, this only happens when the --stream argument is present

I'm also seeing this issue. Tried removing --stream and it still isn't working.

we've had several issues using lerna exec/run and use the concurrently package in place of lerna exec/run. it requires a bit of setup but overall has more features and fewer bugs.

I ended up reverting back to 3.4.0 for the time being until this is fixed.

This change is introduced by commit 7e6d6cd05f3054723c8b015c813e13761659759e, and can be worked around by commenting out these lines in node_modules/react-scripts/scripts/start.js:168


    if (isInteractive || process.env.CI !== 'true') {
      // Gracefully exit when stdin ends
      process.stdin.on('end', function () {
        devServer.close();
        process.exit();
      });
     // Comment out this line
     // process.stdin.resume();
    }

Facing this same issue. I think lerna maybe triggering an end after running a task in parallel.

Instead of commenting out the line I set isInteractive to false, but the issue is still there. Setting CI env to true solves it however.

I have the same issue need rollback to v3.4.0 currently.

I have the same issue, rollback to v3.4.0 is working fine for me! Thanks

Maybe something like this.

    const shouldLernaExecExit = Boolean(!process.env.LERNA_PACKAGE_NAME)
    const shouldCIExecExit = Boolean(process.env.CI)  
    const shouldInteractiveExecExit = Boolean(isInteractive)

    const shoudExitProcess = [
      shouldLernaExecExit,
      shouldCIExecExit,
      shouldInteractiveExecExit
    ] 

    if (shoudExitProcess.includes(true)) {
      // Gracefully exit when stdin ends
      process.stdin.on('end', function() {
        devServer.close();
        process.exit();
      });
      process.stdin.resume();
    }
  } )
  .catch(err => {
    if (err && err.message) {
      console.log(err.message);
    }
    process.exit(1);
  }); 

@ianschmitz thanks for reviewing/merging the fix in https://github.com/facebook/create-react-app/pull/8700 馃檹 ! I see this issue is associated with CRA's 4.0 milestone right now, but would you potentially consider including the fix in a 3.4.2 "patch" release?

Our team is trying to upgrade TypeScript, so we need to upgrade CRA to 3.4.1. But if we upgrade to 3.4.1, then we face this issue with Lerna.

For now, we're planning to use the workaround suggested in https://github.com/facebook/create-react-app/issues/8685#issuecomment-606933276 while running our application locally. Anyways, thanks for all your work on CRA!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

onelson picture onelson  路  3Comments

Aranir picture Aranir  路  3Comments

wereHamster picture wereHamster  路  3Comments

dualcnhq picture dualcnhq  路  3Comments

DaveLindberg picture DaveLindberg  路  3Comments