Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - Debug adapter process has terminated unexpectedly

I am trying to setup debug environment for react-native on VS Code on Mac. This is launch.json :

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug iOS",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "ios",
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react",
            "target": "simulator"
        },
        {
            "name": "Debug Android",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "android",
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        },
        {
            "name": "Attach to packager",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "attach",
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        },
        {
            "name": "Debug in Exponent",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "exponent",
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        }
    ]
}  

On debugging I am getting the error - Debug adapter process has terminated unexpectedly. along with one more error.

enter image description here

I have opened an issue on Github as well but haven't received a solution yet.

Update : In response to ShaneG answer, I am adding screenshots of project scheme and info.plist

enter image description here
enter image description here

like image 338
Nitish Avatar asked Dec 05 '17 09:12

Nitish


3 Answers

Check this: in your .vsCode folder, see if you have a .react folder in there.

If you don't, try running code . from the root directory of your project folder. You will need to install the shell command from VSCode if you haven't already (type shift-command-p and search for Shell command: Install code command PATH).

This was my issue, for whatever reason the .react folder was not being created when I opened VSCode from spotlight.

like image 188
Fletcher Avatar answered Nov 09 '22 18:11

Fletcher


I see its "Debug ios" you ran. Can you make sure its pointing to the correct info.plist file? Many errors can crop up if its pointing to an old info.plist. I can see on the GitHub issue you posted, when you ran it from the command line it outputted a very useful error.

An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier 
build/Build/Products/Debug-iphonesimulator/firstdemo.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Its trying to access the bundleIdentifier but it cannot seem to find it. This info should be inside the info.plist file. Your app might be routed to an old info.plist file that does not have this information.

How to check if its pointing to the correct info.plist?

  • First before we go into the info.plist, in xcode go to Product -> Scheme -> Edit Scheme. In here go to Run and check what your build config is set to. The error above is coming from Debug, so if your build config is set to Release this may be the issue. This may mean Release has the info.plist and Debug does not have this bundle info because its not built in it.

  • In here there is also a "Debug Executable" check box. This may need to be checked

  • If none of that works, although it might, maybe check the info.plist inside your project folder in xcode. See if it has a bundle identifier.

I would say the Scheme section is probably the problem so hopefully that helps you!

like image 35
ShaneG Avatar answered Nov 09 '22 18:11

ShaneG


Delete React Native Tools extension from vs-code and then reinstall it.

It works fine post that.

like image 1
Man Avatar answered Nov 09 '22 18:11

Man