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.
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
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.
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!
Delete React Native Tools extension from vs-code and then reinstall it.
It works fine post that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With