Vscode-react-native: .vscode/launchReactNative.js does not exist

Created on 1 Mar 2016  路  12Comments  路  Source: microsoft/vscode-react-native

Trying to follow the setup/configuration guide. I have a launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug Android",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
                        ...
        },
        {
            "name": "Debug iOS",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
                        ...

Where each launch config references the non-existing file: ${workspaceRoot}/.vscode/launchReactNative.js

How do I get or create this file? Thanks.

Most helpful comment

@maximovicd, thanks for reporting. This is really an odd case, because it sounds like the extension is activated but debugger process somehow is not able to communicate with the extension process.

As a first step in order to get some additional debug information you could try setting up RN_LOG_LEVEL environment variable to Trace and then opening the project in new instance of VSCode and starting debugging session. This might produce some adidtional logs (either in devtools console or in output channel).

As for missing launchReactNative.js - that's okay if you're on version 0.3.0 of extension - this file is no more required to start debugger.

All 12 comments

That file should be automatically generated when you open a react native project when our extension is installed. Make sure that you are opening the root of your react-native project, and that it has a package.json which specifies a dependency on react-native.

Awesome! I forgot I was working from a React/Redux web app template.

Hey there, I'm having a weird combination of these problems:

I don't have any errors in Developer Tools console. I'm able to run React Native: Run Android from Command Palette. I got CLI installed globally only and react-native in app folder, and my launchReactNative.js is not generated and hitting start on debugger gets me the "Unable to set up communication with VSCode react-native extension." error.

I'm using RN 0.42.3.

Let me know if you guys got any idea on what to try out to get debugging working on my side.

@maximovicd, thanks for reporting. This is really an odd case, because it sounds like the extension is activated but debugger process somehow is not able to communicate with the extension process.

As a first step in order to get some additional debug information you could try setting up RN_LOG_LEVEL environment variable to Trace and then opening the project in new instance of VSCode and starting debugging session. This might produce some adidtional logs (either in devtools console or in output channel).

As for missing launchReactNative.js - that's okay if you're on version 0.3.0 of extension - this file is no more required to start debugger.

After update to Version 1.30.0 (1.30.0) the file is disappeared and is not generated anymore

Hi @Hatko technically, we don't need this file anymore for debugging, so don't be afraid, that's completely normal. We will get rid of its mentions in the future releases of the extension.

@ruslan-bikkinin that's fine, but how can we customize the launch configuration if it's program pointed to in launch.json doesn't exist?

@transitive-bullshit what do you mean?

@ruslan-bikkinin how can we add params for each configuration in .vscode/launch.json that will be also passed to run-ios / run-android scripts ? e.g. specify env file, etc.

@majirosstefan you can use envFile and runArguments.

@ruslan-bikkinin thank you, I did not know about runArguments. As I saw, it seems that they are not environment specific or are they ?

What was my point is, that it could be useful in case I have multiple env files (e.g. one for dev environment, one for production, etc.) to simply create more options inside VSCode debug select button or inside launch.json - that could look like this e.g. :

Debug Prod Android (that e.g. takes env.prod),
Debug Dev Android (that takes e.g. env.dev file and some more custom settings),
Debug Prod iOS,
Debug Dev iOS,
etc.

Yes, I know I can do the same by changing env variable before each app-run (in similar way how https://github.com/luggit/react-native-config does) to load data from correct env file, but I thought this could be somehow done by customizing either launchReactNative.js script (which does not exist) or launch.json.

@majirosstefan you can create your own configuration if you want to in addition to the default ones.

Was this page helpful?
0 / 5 - 0 ratings