React Native: "error Cannot start server in new window because no terminal app was specified"

25.1k views Asked by At

After updating to React Native v73.1, I'm getting the below error when trying to run the app in Windows:

error Cannot start server in new window because no terminal app was specified.

How can I fix it?

On a Mac machine, there aren't any issues. Only Windows is facing this issue.

8

There are 8 answers

3
kuimoani On BEST ANSWER

I had the same issue using React Native 0.73.1, when I had to run release mode.

In the case of debug mode, you can simply use npm start and then a.

However, if you want to run release mode, use npm start to run Metro, open a new terminal and execute npx react-native run-android --mode=release.

This worked in my case.

0
Serena Yu On

It looks like Metro has lost support for Windows Terminal and only allows a Bash terminal. I had to launch it once in Git Bash, and keep the Metro window open, before being able to launch React Native in Windows Terminal.

It seems there isn't much we can do, aside from waiting for React Native and Metro to fix it.

I have created an issue there: Metro on Windows: Cannot start server in new window because no terminal app was specified #1160

Enter image description here

1
ericqq On

You can try to use the "npm run start" script.

Image

0
Ajay Kumar Prasad On

Please try => "npx react-native start" script.

0
jamesc On

As referenced in this issue, there is a new --terminal flag where you pass the path to the terminal you want to open. It's still not ideal but it works. For example:

react-native run-android --active-arch-only --mode=devDebug --terminal='C:\\Program Files\\PowerShell\\7\\pwsh.exe'
0
Hakan On

Try this code. It will work.

npm run start
0
jjkim On

If you would like to use Yarn, you can run this on your project folder with Git Bash, which then opens Windows Terminal on the side.

yarn android

Note: running this in Windows Terminal will not work!

0
Aajahid On

It was a bug introduced in the latest React Native CLI. I already pushed a fix for that, and the upcoming React Native CLI should work fine.

Until then, you can use:

npm run start

And then press A to start the Android build.