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

Debug adapter was receiving abnormal input from IPC pipe #758

Closed
stevefan1999-personal opened this issue Jul 27, 2018 · 2 comments
Closed

Comments

@stevefan1999-personal
Copy link

Actual Behavior

  1. Start Expo
  2. Press F5 to start "Attach to packager"
  3. Although the debugger successfully attached, when the Expo was open on the mobile side, the debugger failed miserably immediately due to an unexpected token in JSON feed

Expected Behavior

  1. Start Expo
  2. Press F5 to start "Attach to packager"
  3. Watch my breakpoints

Software versions

  • React-Native VS Code extension version: 0.6.13
  • VSCode version:
    Version: 1.25.1
    Commit: 1dfc5e557209371715f655691b1235b6b26a06be
    Date: 2018-07-11T15:43:53.668Z
    Electron: 1.7.12
    Chrome: 58.0.3029.110
    Node.js: 7.9.0
    V8: 5.8.283.38
    Architecture: x64
    
  • OS platform and version: Microsoft Windows [Version 10.0.17134.165]
  • NodeJS version: v10.7.0
  • React Native version: ~0.55.2
  • Expo SDK version (include if relevant): ^27.0.1
    • Bootstrapped via CRNA

Outputs (Include if relevant)

  • Output of the Debug Console (View -> Toggle Debug Console):
OS: win32 x64
Adapter node: v7.9.0 x64
vscode-chrome-debug-core: 3.17.3
Starting debugger app worker.
Established a connection with the Proxy (Packager) to the React Native application
Debugger worker loaded runtime on port 26933
******** Unhandled error in debug adapter: SyntaxError: Unexpected token L in JSON at position 0
    at JSON.parse (<anonymous>)
    at Pipe.channel.onread (internal/child_process.js:471:28)
  • Output of the React-Native output channel (View -> Toggle Output -> Select React-Native in ListBox):

[Info] Starting Packager

[Debug] Executing command: react-native.cmd start --port 19001 --root .vscode

Scanning folders for symlinks in e:\crna\node_modules (116ms)
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  Running Metro Bundler on port 19001.                                        │
│                                                                              │
│  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
   e:\crna
   e:\crna\.vscode 


Metro Bundler ready.

[Info] Packager started.
Loading dependency graph, done.
Starting custom debugger by executing: echo A debugger is not needed:  "e:\crna" "e:\crna\.vscode"
  • Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):
Debug adapter process has terminated unexpectedly
e.onDidNotificationChange @ notificationsAlerts.ts:42
(anonymous) @ notificationsAlerts.ts:28
e.fire @ event.ts:140
e.notify @ notifications.ts:127
e.error @ notificationService.ts:61
t.onDebugAdapterExit @ rawDebugSession.ts:509
(anonymous) @ rawDebugSession.ts:165
e.fire @ event.ts:140
(anonymous) @ debugAdapter.ts:304
emitTwo @ events.js:111
emit @ events.js:194
__dirname.ChildProcess._handle.onexit @ internal/child_process.js:215

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": [
    {
      "name": "Debug in Exponent",
      "program": "${workspaceRoot}/.vscode/launchReactNative.js",
      "type": "reactnative",
      "request": "launch",
      "platform": "exponent",
      "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"
    }
  ]
}

settings.json:

{
  "react-native": {
    "packager" : {
      "port": 19001
    }
  },
  "react-native-tools": {
    "showInternalLogs": true,
    "logLevel": "Debug"
  }
}

Extra info: I used react-native-typescript-transformer to get TypeScript support, still this is irrelevant to this debugger problem.

@cviktor
Copy link

cviktor commented Jul 30, 2018

I have the same issue. The debugger worked before. I cannot tie the breaking of the debugger to a specific package update

Version: 1.25.1
Commit: 1dfc5e557209371715f655691b1235b6b26a06be
Date: 2018-07-11T15:43:53.668Z
Electron: 1.7.12
Chrome: 58.0.3029.110
Node.js: 7.9.0
V8: 5.8.283.38
Architecture: x64
React native tools: 0.6.13
Expo: 27.0.2

@ruslan-bikkinin
Copy link
Contributor

ruslan-bikkinin commented Aug 30, 2018

Hi again @stevefan1999. We had to undo PR #760 with a fix because it unexpectedly brake stdio communication between debuggee process and debugger. Originally, your issue caused by this one nodejs/node#21671 and I think, that it will be fixed in upcoming 10.10 release of Nodejs. So, as for now to avoid this error, change system nodejs version to 10.5 or lower.

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

4 participants