Skip to content

Metro open in new window instead of tab #2696

Closed

Description

@LaGregance

Describe the Feature

On MacOS with iTerm, on the previous version of the CLI, Metro opened in a new tab instead of a new window.
I don't know if I'm alone in this situation, but I found it extremely painful to have so many windows open.

Possible Implementations

After investigation, this is due to a little change in @react-native-community/cli-tools/build/startServerInNewWindow.js:103:

// Old version
return _execa().default.sync('open', ['-a', terminal, launchPackagerScript], procConfig);

// New version
return _execa().default.sync('open', ['-na', terminal, launchPackagerScript], procConfig);

The last version have -na option instead of -a when running launchPackager.command that force the new window.

If other people are facing the same problem, we may consider putting an environment variable to override these flags, like REACT_LAUNCHPACKAGER_OPTIONS="-a".
For the moment I use patch-package to fix it on my repo.

What do you think about this proposal ?

Activity

  1. andidev commented on Aug 17, 2025

    @andidev

    This is really annoying and also it lead to another bug since the env variables from the start commands are inherited by the new window.

  2. andidev commented on Aug 18, 2025

    @andidev

    Here is some context about the change
    #2628

  3. LaGregance commented on Aug 18, 2025

    @LaGregance
    Author

    Here is some context about the change #2628

    That's interesting to know, but it seems like it's more a bug in the Ghostty terminal than a bug in react-native-cli, right?

  4. makarand-codeblaze commented on Sep 3, 2025

    @makarand-codeblaze

    This is really annoying change. Every time I run the app, it opens a new window. I am using iTerm and it used to work just fine previously. Now even with the REACT_LAUNCHPACKAGER_OPTIONS set to -a its not working as expected.

  5. LaGregance commented on Sep 3, 2025

    @LaGregance
    Author

    This is really annoying change. Every time I run the app, it opens a new window. I am using iTerm and it used to work just fine previously. Now even with the REACT_LAUNCHPACKAGER_OPTIONS set to -a its not working as expected.

    REACT_LAUNCHPACKAGER_OPTIONS isn't an available option, only a proposal I made

  6. added a commit that references this issue on Sep 16, 2025
    1ce219c
  7. added a commit that references this issue on Sep 19, 2025
    ddbba6c
  8. alainib commented on Nov 20, 2025

    @alainib

    any fix ? i get this and it's pretty annoying

  9. LaGregance commented on Nov 20, 2025

    @LaGregance
    Author

    any fix ? i get this and it's pretty annoying

    Not officially but if you use patch-package you can use the following patch @react-native-community+cli-tools+19.1.1.patch:

    diff --git a/node_modules/@react-native-community/cli-tools/build/startServerInNewWindow.js b/node_modules/@react-native-community/cli-tools/build/startServerInNewWindow.js
    index d93ee0b..b1687ed 100644
    --- a/node_modules/@react-native-community/cli-tools/build/startServerInNewWindow.js
    +++ b/node_modules/@react-native-community/cli-tools/build/startServerInNewWindow.js
    @@ -100,7 +100,7 @@ function startServerInNewWindow(port, projectRoot, reactNativePath, terminal) {
       }
       if (process.platform === 'darwin') {
         try {
    -      return _execa().default.sync('open', ['-na', terminal, launchPackagerScript], procConfig);
    +      return _execa().default.sync('open', ['-a', terminal, launchPackagerScript], procConfig);
         } catch (error) {
           return _execa().default.sync('open', [launchPackagerScript], procConfig);
         }
    
  10. added a commit that references this issue on Sep 25, 2026
    00ea9c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions