6

I've created a react-native app in VS Code and trying to run it after settings configuration in launch.json

 "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug Android",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "android",
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        }
    ]

I've device connected to the PC and after settings configurations, I pressed F5 but IDE throws error saying

Error while executing command 'react-native.cmd run-android --no-packager' (error code 101)

Please help me to sort this out. Let me know if you need more details about the problem.

Sushant Somani
  • 1,450
  • 3
  • 13
  • 31

1 Answers1

5

This error can occur due to several reasons. One of the most common reasons is that your connected device has lost connection. Hence it's important to check that your debug device is still connected.

For this you can use the command:

$ adb devices

Make sure that your device is still connected, and visible. If this is not the case, unplug and replug your device.

If that still did not help, you can follow some additional steps as mentioned in the answers here: how-to-fix-error-device-not-found-with-adb-exe


If your device is however connected, and this error still occurs. Fire up a terminal window in vscode and run the command react-native run-android --no-packager directly.

Here you will now most likely see an error such as Error: Command failed: gradlew.bat installDebug appear. Now slowly scroll up till you reach the *where and *what which should contain more details about what actually is going wrong.

A sample of what this looks like:

* Where:
Build file 'D:\micomputapath\android\app\build.gradle' line: 80

* What went wrong:

A problem occurred evaluating project ':app'.

> Could not read script 'D:\micomputapath\node_modules\react-native-sentry\sentry.gradle' as it does not exist.
MX D
  • 2,453
  • 4
  • 35
  • 47