Opening React Native project not generating /launchReactNative.js
Similar to #99
After opening any React-Native project (either freshly created, or an older project) VS Code is not generating the .vscode/launchReactNative.js file that is supposed to be created. This is blocking me from running the debugger giving this error:
Are you opening a folder which contains a package.json that specifies a dependency on react-native? If those conditions are met, then we should create the launchReactNative.js file. Which version of our react-native plugin are you running at the moment? You can find out by hitting f1 and then typing >ext show and selecting show installed extensions.
It looks like I'm using version 0.1.2 of the native plugin.
My Package.json file looks like this:
One final thing I forgot we look for: Is the react-native dependency installed? do you have a node_modules/react-native/ folder with a package.json in it?
@vsccarl: Do you get any kind of errors when you open your React-Native project in VS Code? What happens if you try to use the commands from the React-Native palette like run-android or run-ios? Do they work? Do you get any kind of error?
@MSLaguana Here is what my node_modules/react-native/package.json looks like: package.txt
@digeff There aren't any errors when opening the project. Running the run-android command gives this:
That error on run-android suggests that our extension is not being activated at all. How are you opening your project with vscode? Are you using "open folder", and does the folder that you open contain your package.json directly?
@MSLaguana Yes, I'm using open folder which contains the package.json that I linked earlier:
@vsccarl Could you please go to Help --> Toggle Developer Tools --> Console and check if there are any messages there. If there are, could you please send us a screenshot or paste the text? Thanks!
@digeff Here are the Dev Tools console errors:
Ah, that would explain it! Looks like you've run into https://github.com/Microsoft/vscode-react-native/issues/155
What version of vscode are you using? Are you using 0.10.11?
I'm using 0.10.12-alpha
@vsccarl For the time being I'd advise you to use the latest stable version of VS Code where that error shouldn't be happening. I'll update this issue after we've push a fix for this to master.
@vsccarl The fix is now available on our master branch. It will be included in our next release.
For what it's worth I had the same issue today with a brand new installation of both React Native and this extension. Turns out that the extension had trouble spawning react-native because I had only installed the CLI locally, not globally. Globally installing fixed that issue.
Perhaps instead of launching react-native we should execute the RN within node_modules?
The 'react-native-cli' node package is intended to be installed globally, and that is what we intend to call. That in turn will use a local install of react native to do things. Did you have react-native-cli installed when you hit this?
Sent from Outlook
From: Aidan Steele [email protected] Sent: Monday, October 10, 2016 5:44:10 PM To: Microsoft/vscode-react-native Cc: Jimmy Thomson; Mention Subject: Re: [Microsoft/vscode-react-native] Opening React Native project not generating /launchReactNative.js (#152)
For what it's worth I had the same issue today with a brand new installation of both React Native and this extension. Turns out that the extension had trouble spawning react-native because I had only installed the CLI locally, not globally. Globally installing fixed that issue.
Perhaps instead of launching react-native we should execute the RN within node_modules?
You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2Fvscode-react-native%2Fissues%2F152%23issuecomment-252782712&data=01%7C01%7Cjithomso%40microsoft.com%7C41cb58698337476b8df308d3f16fb7c1%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=3HSwL7h4%2F1Qvn3bIaCivUTE7DYdmEmOsDByaCoa39lU%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANcfpDWjanfGSBSZu6-GUBPrjcOyJCvsks5qytvagaJpZM4Hwmbq&data=01%7C01%7Cjithomso%40microsoft.com%7C41cb58698337476b8df308d3f16fb7c1%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=j0F67tyQvKczWbdyuLTfxdeCHjrtVYl7I9n4I03a7jU%3D&reserved=0.
i just had the same issue, and i have installed the react-native-cli globally. C:\Users\hongxu.lin>react-native -v react-native-cli: 1.0.0 react-native: n/a - not inside a React Native project directory C:\Users\hongxu.lin>cd c:\projects\superL c:\projects\superL>react-native -v react-native-cli: 1.0.0 react-native: 0.34.1
still don't have launchReactNative.js,do you guys @MSLaguana @aidansteele know what's the problem?
Could you please tell me what VSCode extensions you have installed, and also go to Help -> Toggle Developer Tools and tell me if you see any errors in the console there? I've heard reports that having certain other extensions installed can somehow stop ours from loading properly (which would cause this issue).
I have React Native Tools v0.2.0 installed, and my vscode is 1.6.0

That error explains why it isn't working for you: We are trying to run react-native -v in your project, and it is failing to find the global install of react-native. How have you installed it? Is it actually on your PATH?
I can run react-native -v and get react-native-cli: 1.0.0 react-native: n/a - not inside a React Native project directory and i can see react-native-cli under C:\Users\hongxu.lin\AppData\Roaming\npm\node_modules
is that mean i have installed the react-native-cli globally? Any other debug info that may help?