3
votes



i'm trying to use React Native with Visual Studio Code (which should be the best one) but it gives me an error when I try to debug.
I have installed the React Native Tools extension but when I try to start (F5) it returns "[Error] Could not debug. Sure that the reactive-native npm package is installed at the root? "
I also tried sending the command with F1 "> React Native: Run Android" but it returns error "Current workspace is not a React Native project."

I'm using Ubuntu 16.04 LTS.
Visual Studio Code 1.11.2
react-native-cli: 2.0.1
react-native: 0.43.3

Does any of you use Visual Studio Code? Do you have these problems?

My launch.json (the only file generated from extension React Native Tools)

{
    "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"
        },
        {
            "name": "Debug iOS",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "ios",
            "target": "iPhone 5s",
            "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"
        }
    ]
}
2
For those who have problems do as I did, I started using Atom with installed NuclideRiccardo

2 Answers

2
votes

I guess this answer is a tad late.

Your problem is that vscode could not find on your PATH references of react-native.

If you installed it using npm try the following:

npm install react-native --global

This should install it in your path. Restart vscode and you should be good to go.

0
votes

I think it's PATH Problem install it and use:

npm i react-native -g