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

Undefined errors when debugging React Native app in Chrome #18310

Closed
dbarros opened this issue Mar 10, 2018 · 3 comments
Closed

Undefined errors when debugging React Native app in Chrome #18310

dbarros opened this issue Mar 10, 2018 · 3 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@dbarros
Copy link

dbarros commented Mar 10, 2018

I am debugging a React Native application in Google Chrome, but I've noticed that I get a lot of "undefined" errors when I try and run functions, or variables, in the Console. Even though they are actually defined, and within scope.

I may have a file which looks something like this:

import { store } from '../store';
import { createField } from '../fields';

export function foo() {
    return 123;
}

export function bar() {
    return 456;              // breakpoint here
}

When I am stopped at a breakpoint in bar(), and I enter foo() in the Console, I get the following error:

VM163:1 Uncaught ReferenceError: foo is not defined
    at eval (eval at bar (main:105), <anonymous>:1:1)
    at bar (main.js:105)
    at Screen.navigationOptions (Screen.js:26)
    at applyConfig (createConfigGetter.js:28)
    at Object.getScreenOptions (createConfigGetter.js:88)
    at Object.getScreenOptions (createConfigGetter.js:73)
    at Object.getScreenOptions (createConfigGetter.js:73)
    at DrawerView.render (DrawerView.js:153)
    at finishClassComponent (ReactNativeFiber-dev.js:1721)
    at updateClassComponent (ReactNativeFiber-dev.js:1713)

The same error occurs when I enter store, or createField().

Is this some sort of configuration issue in the React Native project, or scope issue in the JavaScript?

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 8.4.0
Yarn: Not Found
npm: 5.3.0
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.0.0-beta.5 => 16.0.0
react-native: ^0.49.5 => 0.49.5

Expected Behavior

When I am at a breakpoint in a JS file, I would expect to be able to call functions defined within it, as well as be able to inspect variables which are in scope.

Actual Behavior

ReferenceError errors when trying the aforementioned.

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest stable release?

Thank you for your contributions.

How to ContributeWhat to Expect from Maintainers

@dbarros
Copy link
Author

dbarros commented Mar 13, 2018

I just upgraded to the latest, 0.54, but the app bombed on start-up with this error (as mentioned din these issues) #18223 #18190

So I down-graded to RN 0.53.3, and I'm still getting the same result as the aforementioned issue.

@dbarros
Copy link
Author

dbarros commented Mar 14, 2018

Looks like it could be an issue with Babel babel/babel#1468

@dbarros dbarros closed this as completed Mar 14, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Mar 14, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants