Vscode-react-native: Could not debug - error code 604

Created on 29 Oct 2019  ยท  13Comments  ยท  Source: microsoft/vscode-react-native

Actual Behavior

  1. run VSCODe
  2. try to debug on iOS or Android
    3 .
Could not debug. Seems to be that you are trying to debug from within directory that is not a React Native project root. 
 If so, please, follow these instructions: https://github.com/Microsoft/vscode-react-native/blob/master/doc/customization.md#project-structure. (error code 604)

4 - after I removed rn cli from global :

******** Unhandled error in debug adapter - Unhandled promise rejection: Error: spawn react-native ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Could not debug. Seems to be that you are trying to debug from within directory that is not a React Native project root. 
 If so, please, follow these instructions: https://github.com/Microsoft/vscode-react-native/blob/master/doc/customization.md#project-structure. (error code 604)

Screen Shot 2019-10-29 at 10 50 03 AM

Screen Shot 2019-10-29 at 10 53 20 AM

Expected Behavior

  1. just run as normal as before

Software versions

  • React-Native VS Code extension version: latest - 0.12.1
  • VSCode version: latest - 1.39.2
  • OS platform and version: mac - latest - 10.15
  • NodeJS version: latest - 12.12.0
  • React Native version: 0.61.2
  • Expo SDK version (include if relevant): -
fix-in-master resolved

Most helpful comment

@ramyareye We prepare a release where react-native-cli dependency will be dropped, so as soon as it will be released that problem should be resolved. We'll let you know when a new version will be released.

All 13 comments

Hi @ramyareye and thanks for reaching us. Could you please add trace: "verbose" line into your debug configurations and send us an output with this option enabled? It will be helpful for better understanding of the situation from our side.

OS: darwin x64
Adapter node: v10.11.0 x64
vscode-chrome-debug-core: 6.8.2
From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"reactnative","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"exceptionBreakpointFilters":[{"label":"All Exceptions","filter":"all","default":false},{"label":"Uncaught Exceptions","filter":"uncaught","default":false}],"supportsConfigurationDoneRequest":true,"supportsSetVariable":true,"supportsConditionalBreakpoints":true,"supportsCompletionsRequest":true,"supportsHitConditionalBreakpoints":true,"supportsRestartFrame":true,"supportsExceptionInfoRequest":true,"supportsDelayedStackTraceLoading":true,"supportsValueFormattingOptions":true,"supportsEvaluateForHovers":true,"supportsLoadedSourcesRequest":true,"supportsBreakpointLocationsRequest":true,"supportsLogPoints":true,"supportsTerminateRequest":true}}
******** Unhandled error in debug adapter - Unhandled promise rejection: Error: spawn react-native ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Could not debug. Seems to be that you are trying to debug from within directory that is not a React Native project root. 
 If so, please, follow these instructions: https://github.com/Microsoft/vscode-react-native/blob/master/doc/customization.md#project-structure. (error code 604)



md5-b7ac81b3e56958e13c481e618a79565a



To client: {"seq":0,"type":"event","event":"terminated"}
From client: disconnect({"restart":false})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"FullSessionStatistics/SourceMaps/Overrides","data":{"aspNetClientAppFallbackCount":0}}}
To client: {"seq":0,"type":"response","request_seq":3,"command":"disconnect","success":true}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"debugStopped","data":{"reason":"Got disconnect request"}}}

@SounD120 any chance for this ?

@ramyareye We prepare a release where react-native-cli dependency will be dropped, so as soon as it will be released that problem should be resolved. We'll let you know when a new version will be released.

@ramyareye React Native Tools v0.13.0 just have been released. Please try it out and let us know how it works for you.

@SounD120

Handle launch request: {
  "name": "Debug iOS",
  "cwd": "/.../project",
  "type": "reactnative",
  "request": "launch",
  "platform": "ios",
  "trace": "verbose",
  "__sessionId": "1913a91a-63e6-412f-83c8-14686aeafdb9",
  "sourceMaps": true
}
Could not debug. Error while executing command '/.../node_modules/.bin/react-native run-ios --simulator --no-packager --verbose': Error while executing command '/.../node_modules/.bin/react-native run-ios --simulator --no-packager --verbose' (error code 101)
To client: {"seq":0,"type":"event","event":"terminated"}
From client: disconnect({"restart":false})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"FullSessionStatistics/SourceMaps/Overrides","data":{"aspNetClientAppFallbackCount":0}}}
To client: {"seq":0,"type":"response","request_seq":3,"command":"disconnect","success":true}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"debugStopped","data":{"reason":"Got disconnect request"}}}

I run rn like :

npx react-native run-ios

as said here in docs, so maybe you should put an option or get rid of global one ?

@ramyareye Could you please also attach logs from React Native and React Native: Run ios output channels? This logs will be helpful for better understanding of the situation from our side.

this is react native log

[Info] Starting Packager

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                              โ”‚
โ”‚  Running Metro Bundler on port 8081.                                         โ”‚
โ”‚                                                                              โ”‚
โ”‚  Keep Metro running while developing on any JS projects. Feel free to        โ”‚
โ”‚  close this tab and run your own Metro instance if you prefer.               โ”‚
โ”‚                                                                              โ”‚
โ”‚  https://github.com/facebook/react-native                                    โ”‚
โ”‚                                                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Looking for JS files in
   /Users/.../project 

[Info] Packager started.

[Info] Prewarming bundle cache. This may take a while ...

[Info] About to get: http://localhost:8081/index.bundle?platform=ios

Loading dependency graph, done.
 BUNDLE  [ios, dev] ./index.js โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“ 100.0% (1535/1535), done.

[Warning] The Bundle Cache was prewarmed.

[Info] Building and running application.

[Error] Error: Error while executing command '/.../project/node_modules/.bin/react-native run-ios --simulator --no-packager --verbose': Error while executing command '/.../project/node_modules/.bin/react-native run-ios --simulator --no-packager --verbose' (error code 101)

react-native run-ios

[Info] Starting React Native Packager.

info Found Xcode workspace "seeko.xcworkspace"
error Could not find "iPhone X" simulator

I think plugin is trying react-native run-ios right ?
you may add an option to channge it to npx react-native run-ios

@ramyareye After the update, the extension acts the same as an npx command, it gets binary file from node_modules/.bin and runs it.
As seen from your logs the problem is pretty similar to this and may be not connected to the extension. I'd recommend to add: target: "<simulator name>" property in your Debug iOS scenario and try to run debugging another time.
Please let us know if it helped.

Works well, thanks!

I am trying to Debug my react native app but debug console console showing the following error.
My project root name and project name in _Setting.gradle_ is same

Debug Console Error

OS: win32 x64
Adapter node: v12.4.0 x64
vscode-chrome-debug-core: 6.8.2
Could not debug. Seems to be that you are trying to debug from within directory that is not a React Native project root. 
 If so, please, follow these instructions: https://github.com/Microsoft/vscode-react-native/blob/master/doc/customization.md#project-structure. (error code 604)

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": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}\\start"
        },{
            "name": "Debug Android",
            "cwd": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "android",
            "sourceMaps": true,
        }
    ]
}

I already installed cli globally by npm i -g react-native-cli
i have installed react-native-tools

i don't know what i am missing

Hi @DarshanTCMACC . Could you please create a new issue describing your specific case?
Also as seen from your Debug Android debug scenario cwd parameter is incorrect. Please try to change it to"cwd": "${workspaceFolder} and try to execute debugging again.

okay fine ! @SounD120
Edit: Thanks for Suggestion its working now.. @SounD120

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterp picture peterp  ยท  4Comments

vsccarl picture vsccarl  ยท  3Comments

webda2l picture webda2l  ยท  3Comments

vladimir-kotikov picture vladimir-kotikov  ยท  5Comments

andreyleonardo picture andreyleonardo  ยท  3Comments