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 android task doesn't start metro bundler correctly #730

Closed
allforabit opened this issue Jun 15, 2018 · 20 comments
Closed

Debug android task doesn't start metro bundler correctly #730

allforabit opened this issue Jun 15, 2018 · 20 comments

Comments

@allforabit
Copy link

allforabit commented Jun 15, 2018

Actual Behavior

  1. Run debug android task
  2. Debugging is not started and shows the errors indicated in the react-native output below

Expected Behavior

  1. Run debug android task
  2. Debugging should start successfully

Software versions

  • React-Native VS Code extension version: 0.6.11
  • VSCode version: 1.24.1
  • OS platform and version: Windows 10
  • NodeJS version: 8.11.1
  • React Native version: 0.55.4
  • Expo SDK version (include if relevant):

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 27317
Couldn't import script at <http://localhost:8081/index.bundle?platform=android&dev=true&minify=false>. Debugging won't work: Try reloading the JS from inside the app, or Reconnect the VS Code debugger: {"message":"Cannot find entry file index.js in any of the roots: [\"c:\\\\Users\\\\Admin\\\\Documents\\\\GitHub\\\\elephantbrain\"]","name":"NotFoundError","type":"NotFoundError","status":404,"errors":[{"description":"Cannot find entry file index.js in any of the roots: [\"c:\\\\Users\\\\Admin\\\\Documents\\\\GitHub\\\\elephantbrain\"]"}],"stack":"NotFoundError: Cannot find entry file index.js in any of the roots: [\"c:\\\\Users\\\\Admin\\\\Documents\\\\GitHub\\\\elephantbrain\"]\n    at DependencyGraph.getAbsolutePath (c:\\Users\\Admin\\Documents\\GitHub\\elephantbrain\\node_modules\\metro\\src\\node-haste\\DependencyGraph.js:317:11)\n    at c:\\Users\\Admin\\Documents\\GitHub\\elephantbrain\\node_modules\\metro\\src\\DeltaBundler\\DeltaCalculator.js:280:416\n    at Generator.next (<anonymous>)\n    at step (c:\\Users\\Admin\\Documents\\GitHub\\elephantbrain\\node_modules\\metro\\src\\DeltaBundler\\DeltaCalculator.js:11:445)\n    at c:\\Users\\Admin\\Documents\\GitHub\\elephantbrain\\node_modules\\metro\\src\\DeltaBundler\\DeltaCalculator.js:11:605\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:188:7)"}
  • Output of the React-Native output channel (View -> Toggle Output -> Select React-Native in ListBox):
[Info] Starting Packager

Scanning folders for symlinks in c:\Users\Admin\Documents\GitHub\elephantbrain\node_modules (57ms)
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  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
   c:\Users\Admin\Documents\GitHub\elephantbrain 


Metro Bundler ready.

[Info] Packager started.

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

[Info] Entry point at c:\Users\Admin\Documents\GitHub\elephantbrain\index.android.js doesn't exist. Skipping prewarming...

[Info] Building and running application.

[Info] Enable JS Debugging

Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Documents\GitHub\elephantbrain"
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Documents\GitHub\elephantbrain"
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Documents\GitHub\elephantbrain"
Loading dependency graph, done.
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Documents\GitHub\elephantbrain"
error: bundling failed: NotFoundError: Cannot find entry file index.js in any of the roots: ["c:\\Users\\Admin\\Documents\\GitHub\\elephantbrain"]
    at DependencyGraph.getAbsolutePath (c:\Users\Admin\Documents\GitHub\elephantbrain\node_modules\metro\src\node-haste\DependencyGraph.js:317:11)
    at c:\Users\Admin\Documents\GitHub\elephantbrain\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:280:416
    at Generator.next (<anonymous>)
    at step (c:\Users\Admin\Documents\GitHub\elephantbrain\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:11:445)
    at c:\Users\Admin\Documents\GitHub\elephantbrain\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:11:605
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.
  • Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):
INFO no standard startup: panel is active
TMSyntax.ts:44 Overwriting grammar scope name to file mapping for scope source.sql.
Old grammar file: c:\Program Files\Microsoft VS Code\resources\app\extensions\sql\syntaxes\sql.tmLanguage.json.
New grammar file: c:\Users\Admin\.vscode\extensions\ms-mssql.mssql-1.3.1\syntaxes\SQL.plist
e.register @ TMSyntax.ts:44
notificationsAlerts.ts:42 [Toggl] Api key not defined
e.onDidNotificationChange @ notificationsAlerts.ts:42
console.ts:136 [Extension Host] Activating extension 'armaklan.vscode-toggl' failed: You should either specify apiToken or username and password.
t.log @ console.ts:136
console.ts:136 [Extension Host] Activating extension `armaklan.vscode-toggl` failed:  You should either specify apiToken or username and password
t.log @ console.ts:136
console.ts:136 [Extension Host] Here is the error stack:  Error: You should either specify apiToken or username and password
	at validateOptions (C:\Users\Admin\.vscode\extensions\armaklan.vscode-toggl-0.0.5\node_modules\toggl-api\lib\client.js:333:11)
	at new TogglClient (C:\Users\Admin\.vscode\extensions\armaklan.vscode-toggl-0.0.5\node_modules\toggl-api\lib\client.js:34:5)
	at new TogglClient (C:\Users\Admin\.vscode\extensions\armaklan.vscode-toggl-0.0.5\toggl.js:7:20)
	at Object.<anonymous> (C:\Users\Admin\.vscode\extensions\armaklan.vscode-toggl-0.0.5\extension.js:17:18)
	at Object.<anonymous> (C:\Users\Admin\.vscode\extensions\armaklan.vscode-toggl-0.0.5\extension.js:131:3)
	at Module._compile (module.js:571:32)
	at Object.Module._extensions..js (module.js:580:10)
	at Module.load (module.js:488:32)
	at tryModuleLoad (module.js:447:12)
	at Function.Module._load (module.js:439:3)
	at Function.o._load (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:735:300)
	at Module.require (module.js:498:17)
	at Module.patchedRequire [as require] (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\node_modules\diagnostic-channel\dist\src\patchRequire.js:14:46)
	at require (internal/module.js:20:19)
	at Function.i [as __$__nodeRequire] (c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js:30:770)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:759:932
	at t._doActivateExtension (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:760:25)
	at t._activateExtension (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:758:910)
	at Object.actualActivateExtension (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:756:770)
	at e._activateExtension (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:444:188)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:443:757
	at Array.map (native)
	at e._activateExtensions (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:443:732)
	at e.activateByEvent (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:442:14)
	at t.activateByEvent (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:757:139)
	at t.handleEagerExtensions (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:780:392)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:779:608
	at Object.g [as _notify] (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:76:971)
	at Object.enter (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:80:277)
	at n.Class.derive._oncancel._run (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:82:84)
	at n.Class.derive._oncancel._completed (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:81:523)
	at e.open (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:106:990)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:756:808
	at Object.g [as _notify] (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:76:971)
	at Object.enter (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:80:277)
	at n.Class.derive._oncancel._run (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:82:84)
	at n.Class.derive._oncancel._completed (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:81:523)
	at c (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:84:1011)
	at K.then.o.(anonymous function) (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:85:205)
	at Object.g [as _notify] (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:76:971)
	at Object.enter (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:80:277)
	at n.Class.derive._oncancel._run (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:82:84)
	at n.Class.derive._oncancel._completed (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:81:523)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:110:917
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:144:48
	at LOOP (fs.js:1728:14)
	at _combinedTickCallback (internal/process/next_tick.js:73:7)
	at process._tickCallback (internal/process/next_tick.js:104:9)
extensionService.ts:870 Activating extension 'armaklan.vscode-toggl' failed: You should either specify apiToken or username and password.
w._logMessageInConsole @ extensionService.ts:870
console.ts:136 [Extension Host] (node:11108) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
t.log @ console.ts:136
713console.ts:136 [Extension Host] INVALID text edit -> must be single line and on the same line
t.log @ console.ts:136
webviewElement.ts:132 [Embedded Page] Refused to load the image 'http://vsmarketplacebadge.apphb.com/version-short/EQuimper.react-native-react-redux-snippets-for-es6-es7-version-standard.svg' because it violates the following Content Security Policy directive: "img-src https: data:".

webviewElement.ts:132 [Embedded Page] Refused to load the image 'http://vsmarketplacebadge.apphb.com/installs-short/EQuimper.react-native-react-redux-snippets-for-es6-es7-version-standard.svg' because it violates the following Content Security Policy directive: "img-src https: data:".

webviewElement.ts:132 [Embedded Page] Refused to load the image 'http://vsmarketplacebadge.apphb.com/rating-short/EQuimper.react-native-react-redux-snippets-for-es6-es7-version-standard.svg' because it violates the following Content Security Policy directive: "img-src https: data:".

notificationsAlerts.ts:42 ESLint: ESLint configuration in C:\Users\Admin\Documents\GitHub\elephantbrain\.eslintrc is invalid: 	- Unexpected top-level property "semi". . Please see the 'ESLint' output channel for details.
e.onDidNotificationChange @ notificationsAlerts.ts:42
console.ts:136 [Extension Host] ApplicationInsights:Sender Array(1)
t.log @ console.ts:136
log.ts:171   ERR Cannot read property 'lineNumber' of null: TypeError: Cannot read property 'lineNumber' of null
	at Object.e.to (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:641:780)
	at e.provideHover (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:690:71)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:704:93
	at e._withAdapter (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:701:385)
	at e.$provideHover (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:704:55)
	at e._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:636:832)
	at e._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:636:550)
	at e._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:631)
	at e._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:400)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:634:315
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:637:395
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:95:432
	at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:96:764)
	at Socket.<anonymous> (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:154:338)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Socket.Readable.push (_stream_readable.js:136:10)
	at Pipe.onread (net.js:560:20)
console.ts:136 [Extension Host] 11:31:03 - VimState: invalid value for set cursor position. This is probably bad?
2console.ts:136 [Extension Host] Error: Illegal value for `line`
	at t._lineAt (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:476:662)
	at Object.lineAt (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:475:373)
	at Function.getLineAt (C:\Users\Admin\.vscode\extensions\vscodevim.vim-0.12.0\out\src\textEditor.js:121:56)
	at ModeHandler.<anonymous> (C:\Users\Admin\.vscode\extensions\vscodevim.vim-0.12.0\out\src\mode\modeHandler.js:485:67)
	at Generator.next (<anonymous>)
	at fulfilled (C:\Users\Admin\.vscode\extensions\vscodevim.vim-0.12.0\out\src\mode\modeHandler.js:4:58)
	at <anonymous>
t.log @ console.ts:136

This is the same issue as #674. The workaround is to just start the bundler in the terminal and then let debugging hook in to that but it would be nice if it all launched with one command.

@itoys
Copy link
Contributor

itoys commented Jun 18, 2018

Hi @allforabit,
Please reset your cache and try again
https://gist.github.com/jarretmoses/c2e4786fd342b3444f3bc6beff32098d

Thanks!

@itoys
Copy link
Contributor

itoys commented Jun 21, 2018

@allforabit any results?

@allforabit
Copy link
Author

Hi apologies I haven't had a chance to check just yet but will do at some point today or tomorrow. Thanks!

@allforabit
Copy link
Author

allforabit commented Jun 25, 2018

Hi @itoys apologies about the delay. I've cleared out the cache and even started a new project (based on react-native init MyProject and am still having no luck. Please note the instructions to clear the cache aren't specific to Windows and are a bit of date as far as I can see. I followed along as closely as possible and manually removed any folders that might have been causing problems. I also cleared out my global yarn dependencies and reinstalled react-native-cli globally. I have tried on my mac and I'm not getting the issue. On Windows I only experience problems when trying to run from vscode-react-native. Starting with react-native run-android works fine. Here's the output from my attempt just now to start the app:

[Info] Starting Packager

Scanning folders for symlinks in c:\Users\Admin\Desktop\RNTest\node_modules (31ms)
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  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
   c:\Users\Admin\Desktop\RNTest 


Metro Bundler ready.

[Info] Packager started.

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

[Info] Entry point at c:\Users\Admin\Desktop\RNTest\index.android.js doesn't exist. Skipping prewarming...

[Info] Building and running application.

Loading dependency graph, done.
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Desktop\RNTest"
[Info] Enable JS Debugging

Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Desktop\RNTest"
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Desktop\RNTest"
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Desktop\RNTest"
error: bundling failed: NotFoundError: Cannot find entry file index.js in any of the roots: ["c:\\Users\\Admin\\Desktop\\RNTest"]
    at DependencyGraph.getAbsolutePath (c:\Users\Admin\Desktop\RNTest\node_modules\metro\src\node-haste\DependencyGraph.js:317:11)
    at c:\Users\Admin\Desktop\RNTest\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:280:416
    at Generator.next (<anonymous>)
    at step (c:\Users\Admin\Desktop\RNTest\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:11:445)
    at c:\Users\Admin\Desktop\RNTest\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:11:605
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.

Thanks very much. Let me know if there's any other details that might help.

@itoys
Copy link
Contributor

itoys commented Jun 25, 2018

@allforabit
Could you please run react-native run-android and paste packager outputs here?
And outputs of react-native -v

@allforabit
Copy link
Author

allforabit commented Jun 25, 2018

Here you go @itoys ...

Initial screen:

C:\Users\Admin\Desktop\RNTest>react-native run-android
Scanning folders for symlinks in C:\Users\Admin\Desktop\RNTest\node_modules (20ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee130Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore130Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp3130Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0554Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug
:app:packageDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_4_API_22(AVD) - 5.1.1' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 8.416 secs
Running E:\Android\sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (E:\Android\sdk/platform-tools/adb -s emulator-5554 shell am start -n com.rntest/com.rntest.MainActivity)...
Starting: Intent { cmp=com.rntest/.MainActivity }

Metro bundler popup window:

Scanning folders for symlinks in C:\Users\Admin\Desktop\RNTest\node_modules (30ms)
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  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
   C:\Users\Admin\Desktop\RNTest


Metro Bundler ready.

Loading dependency graph, done.
 BUNDLE  [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (481/481), done.

@itoys
Copy link
Contributor

itoys commented Jun 25, 2018

All clues say that it's issue with watchman's cache, could you please try to reset it in vscode terminal?

@allforabit
Copy link
Author

Thanks for all the help. Unfortunately I'm still experiencing the issue.

Just to confirm. I cleared the watchman cache by running this command in the project root:

C:\Users\Admin\Desktop\RNTest>watchman watch-del-all
{
    "version": "4.9.1",
    "roots": [
        "C:/Users/Admin/Desktop/RNTest"
    ]
}

It does seem to get a bit further along but gives me the following error in the debug output:

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 12436
Couldn't import script at <http://localhost:8081/index.bundle?platform=android&dev=true&minify=false>. Debugging won't work: Try reloading the JS from inside the app, or Reconnect the VS Code debugger: {"message":"Cannot find entry file index.js in any of the roots: [\"c:\\\\Users\\\\Admin\\\\Desktop\\\\RNTest\"]","name":"NotFoundError","type":"NotFoundError","status":404,"errors":[{"description":"Cannot find entry file index.js in any of the roots: [\"c:\\\\Users\\\\Admin\\\\Desktop\\\\RNTest\"]"}],"stack":"NotFoundError: Cannot find entry file index.js in any of the roots: [\"c:\\\\Users\\\\Admin\\\\Desktop\\\\RNTest\"]\n    at DependencyGraph.getAbsolutePath (c:\\Users\\Admin\\Desktop\\RNTest\\node_modules\\metro\\src\\node-haste\\DependencyGraph.js:317:11)\n    at c:\\Users\\Admin\\Desktop\\RNTest\\node_modules\\metro\\src\\DeltaBundler\\DeltaCalculator.js:280:416\n    at Generator.next (<anonymous>)\n    at step (c:\\Users\\Admin\\Desktop\\RNTest\\node_modules\\metro\\src\\DeltaBundler\\DeltaCalculator.js:11:445)\n    at c:\\Users\\Admin\\Desktop\\RNTest\\node_modules\\metro\\src\\DeltaBundler\\DeltaCalculator.js:11:605\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:188:7)"}

And the following error in React Native output:

[Info] Starting Packager

Scanning folders for symlinks in c:\Users\Admin\Desktop\RNTest\node_modules (23ms)
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  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
   c:\Users\Admin\Desktop\RNTest 


Metro Bundler ready.

[Info] Packager started.

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

[Info] Entry point at c:\Users\Admin\Desktop\RNTest\index.android.js doesn't exist. Skipping prewarming...

[Info] Building and running application.

Loading dependency graph, done.
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Desktop\RNTest"
[Info] Enable JS Debugging

Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Desktop\RNTest"
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Desktop\RNTest"
Starting custom debugger by executing: echo A debugger is not needed:  "c:\Users\Admin\Desktop\RNTest"
error: bundling failed: NotFoundError: Cannot find entry file index.js in any of the roots: ["c:\\Users\\Admin\\Desktop\\RNTest"]
    at DependencyGraph.getAbsolutePath (c:\Users\Admin\Desktop\RNTest\node_modules\metro\src\node-haste\DependencyGraph.js:317:11)
    at c:\Users\Admin\Desktop\RNTest\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:280:416
    at Generator.next (<anonymous>)
    at step (c:\Users\Admin\Desktop\RNTest\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:11:445)
    at c:\Users\Admin\Desktop\RNTest\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:11:605
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.

@itoys
Copy link
Contributor

itoys commented Jun 28, 2018

Could you please try to debug?
Please add following string to your src/common/commandExecutor.js file:

this.logger.error(JSON.stringify(spawnOptions.env, null, 2));

How to find extension files please see here

Also please check, which env vars you have in your command line:

$ node
> process.env

PATH vars should be equal

@bogdant
Copy link

bogdant commented Jun 28, 2018

Experiencing the same issue

@allforabit
Copy link
Author

Thanks @itoys I will try to do this today but if not over the weekend.

@allforabit
Copy link
Author

I have it building successfully now. However I'm not sure where in that file I should add that line of code (this.logger.error(JSON.stringify(spawnOptions.env, null, 2));). Thanks @itoys

@itoys
Copy link
Contributor

itoys commented Jul 2, 2018

@allforabit
Glad to hear that!
You should be add logging on line 154, my fault, sorry.
Could you please share how did you fix this issue?

Thanks!

@itoys itoys closed this as completed Jul 2, 2018
@allforabit
Copy link
Author

Ok thanks @itoys I'll add that to that line. Sorry I meant I had got the vscode-react-native plugin built and working. I still haven't got it actually working.

@itoys itoys reopened this Jul 3, 2018
@itoys
Copy link
Contributor

itoys commented Jul 3, 2018

@allforabit
Any info from logs would be helpful!
My main idea is that vscode and cmd uses different environment variables and/or different nodejs versions.
Do you use nvm or something else for managing nodejs versions?

Unfortunately I still can't repro this.

@allforabit
Copy link
Author

Yes I'm using nvm for windows so that could be the root of the problems. I'll get back to you with this info asap.

@ruslan-bikkinin
Copy link
Contributor

Hi @allforabit I noticed that you have several errors in Developer Tools console output that caused by other extensions. Could you please try to uninstall those extensions for a while and try to debug your app again?

@itoys
Copy link
Contributor

itoys commented Jul 5, 2018

@allforabit
Any updates?

@allforabit
Copy link
Author

Sorry I've had a very busy week and haven't had a chance yet. It really sounds like it's an issue with my setup though. Feel free to close for now. Hope to have another look over the weekend.

@itoys itoys closed this as completed Jul 5, 2018
@hugey010
Copy link

I'm having this same issue and I'm not sure why this got closed. Running react-native run-android and then attaching the vscode debugger works fine. It is a valid workaround but quite annoying.

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

5 participants