cli: Windows: Cannot start server in new window because no terminal app was specified

Do you want to request a feature or report a bug?

Report a bug

It’s originally raised on StackOverflow https://stackoverflow.com/questions/77684266/react-native-error-cannot-start-server-in-new-window-because-no-terminal-app-wa/77688826

What is the current behavior?

When launching react-native metro on Windows, it gets “error Cannot start server in new window because no terminal app was specified”.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

It’s really just a fresh react-native project using the standard init.

npx react-native@latest init AwesomeProject && cd ./AwesomeProject && npm run android

If you don’t like to run it yourself, I have created a repo for you. No customization whatsoever, just a fresh react-native project.

https://github.com/feng-yu-healthbank/AwesomeProject

Please note the error is specific to Windows.

What is the expected behavior?

The empty project launches into an Android emulator by npm run android.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

It’s a fresh official react-native sample project. No customization is applied.

Metro version

"metro": "^0.80.0"

metro config:

const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');

/**
 * Metro configuration
 * https://facebook.github.io/metro/docs/configuration
 *
 * @type {import('metro-config').MetroConfig}
 */
const config = {};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);

npx react-native info

System:
  OS: Windows 11 10.0.22621
  CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700K
  Memory: 27.55 GB / 63.77 GB
Binaries:
  Node:
    version: 20.10.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.19
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 9.7.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman:
    version: 20231008.002904.0
    path: C:\ProgramData\chocolatey\bin\watchman.EXE
SDKs:
  Android SDK:
    Android NDK: 22.1.7171670
  Windows SDK:
    AllowAllTrustedApps: Disabled
    Versions:
      - 10.0.19041.0
IDEs:
  Android Studio: AI-231.9392.1.2311.11076708
  Visual Studio: Not Found
Languages:
  Java: 17.0.9
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1
    wanted: 0.73.1
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

image

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Reactions: 12
  • Comments: 31

Most upvoted comments

I fix my problem with

npx react-native run-android --terminal powershell

however I want to use only npx react-native run-android

Same here. I upgraded from react-native@0.72 to react-native@0.73.1, and then, the problem occurred.

I found a temporary solution that is to use npm run start or npm start instead of npm run android mentioned in this stackoverflow page

Sure, I’ve recorded 2 GIFs below. When I run ‘yarn android:test’ it is the following npm script:

react-native run-android --active-arch-only --mode=devDebug

The first video, you can see that even after waiting for over a minute, the Android build doesn’t start. You have to press a in the Metro terminal but then all of the parameters are lost

metro1

This second video, I run the same script with Metro already running and the Android build starts immediately

metro2

Same issue, trying to solve it.

temporary is run script: npx react-native start and after that type mode a

on MacOS M1 14.2.1 (23C71)

react-native run-android --terminal terminal

worked for me, and then for easy access, I added this under the scripts in package.json file

"android": "react-native run-android --terminal terminal",
"ios": "react-native run-ios --terminal terminal",

and then yarn android works fine

Getting this bug on windows+android on 0.73.1. Works fine on 0.73.0. Not tested on mac/ios.

Try running the following command:😊

npx react-native start

however I want to use only npx react-native run-android

you can also do npx react-native run-android --terminal

PS FILE_PATH> npx react-native run-android --terminal error: option ‘–terminal <string>’ argument missing

It was asking string like node, powershell etc.

Same issue, trying to solve it.

temporary is run script: npx react-native start and after that type mode a

This works for me, thx.

I ran “npx react-native start”, then hit “a” when it gave me the option to

Hey @Navpan18, @coder-xiaomo can you try passing via --terminal flag a path to executable file of your terminal? and say if that is working 😃

This works for me. However it only opens a new window and doesn’t automatically run andoid, it acts as if you’ve run react-native start only

Same here. I upgraded from react-native@0.72 to react-native@0.73.1, and then, the problem occurred.

I found a temporary solution that is to use npm run start or npm start instead of npm run android mentioned in this stackoverflow page

Check if your app works fine in RN 0.72.8