Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not debug - error code 604 #1150

Closed
ramyareye opened this issue Oct 29, 2019 · 13 comments
Closed

Could not debug - error code 604 #1150

ramyareye opened this issue Oct 29, 2019 · 13 comments

Comments

@ramyareye
Copy link

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): -
@SounD120
Copy link
Contributor

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.

@ramyareye
Copy link
Author

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)
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"}}}

@ramyareye
Copy link
Author

@SounD120 any chance for this ?

@SounD120
Copy link
Contributor

SounD120 commented Nov 5, 2019

@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.

@SounD120
Copy link
Contributor

SounD120 commented Nov 6, 2019

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

@ramyareye
Copy link
Author

@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 ?

@SounD120
Copy link
Contributor

SounD120 commented Nov 7, 2019

@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.

@SounD120 SounD120 self-assigned this Nov 7, 2019
@ramyareye
Copy link
Author

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

@SounD120
Copy link
Contributor

SounD120 commented Nov 7, 2019

@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.

@ramyareye
Copy link
Author

Works well, thanks!

@DarshanTCMACC
Copy link

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

@SounD120
Copy link
Contributor

SounD120 commented Dec 3, 2019

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.

@DarshanTCMACC
Copy link

DarshanTCMACC commented Dec 3, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants