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 is not an object (evaluating 'regeneratorRuntime.mark') #14838

Closed
Amurmurmur opened this issue Jul 5, 2017 · 92 comments
Closed

undefined is not an object (evaluating 'regeneratorRuntime.mark') #14838

Amurmurmur opened this issue Jul 5, 2017 · 92 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@Amurmurmur
Copy link

Amurmurmur commented Jul 5, 2017

Is this a bug report?

Yes
(write your answer here)

Have you read the Bugs section of the Contributing to React Native Guide?

(Write your answer here.)

Environment

  1. react-native -v: 0.45.1
  2. node -v: 8.1.3
  3. npm -v: 5.0.4
  4. yarn --version (if you use Yarn): 0.27.5

Then, specify:

  1. Target Platform (e.g. iOS, Android): Android
  2. Development Operating System (e.g. macOS Sierra, Windows 10): macOS Sierra 10.12.5
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant): Android SDK 25, Android Build Tools 25.0.2

Steps to Reproduce

(Write your steps here:)

  1. react-native init AwesomeProject
  2. react-native run-android

Expected Behavior

Should work as it did with RN v0.44.0 or RN 0.45.0
(Write what you thought would happen.)

Actual Behavior

undefined is not an object (evaluating 'regeneratorRuntime.mark')
<unknown>
    
loadModuleImplementation
    require.js:174:12
guardedLoadModule
    require.js:126:36
_require
    require.js:110:24
<unknown>
    index.js:2
loadModuleImplementation
    require.js:174:12
guardedLoadModule
    require.js:126:36
_require
    require.js:110:24
<unknown>
    configureStore.js:19
loadModuleImplementation
    require.js:174:12
guardedLoadModule
    require.js:126:36
_require
    require.js:110:24
<unknown>
    index.js:32
loadModuleImplementation
    require.js:174:12
guardedLoadModule
    require.js:126:36
_require
    require.js:110:24
<unknown>
    index.android.js:10
loadModuleImplementation
    require.js:174:12
guardedLoadModule
    require.js:119:45
_require
    require.js:110:24
global code
   

screen shot 2017-07-05 at 22 42 33

(Write what happened. Add screenshots!)

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

@messense
Copy link

messense commented Jul 6, 2017

+1

@messense
Copy link

messense commented Jul 6, 2017

I am getting this on 0.46

@Amurmurmur
Copy link
Author

Alright seems like I've managed to fix this on RN 0.45.1
Just clean everything:

watchman watch-del-all
rm -rf $TMPDIR/react-*
rm -rf yarn.lock
rm -rf ./node_modules
yarn install

Worked for me, also unlinking and linking might help.

@ernoaapa
Copy link

ernoaapa commented Jul 6, 2017

Face same problem when creating new project with Ignite.

  • react-native -V 0.45.1
  • node -v v7.10.0
  • npm -v 4.2.0
  • yarn --version 0.27.5
  • react-native run-ios

@Amurmurmur suggestion didn't help.

@ernoaapa
Copy link

ernoaapa commented Jul 6, 2017

Found the problem what I had (with new project generated with Ignite).

The error were pointing in my project to line import rootSaga from '../Sagas/' which contain export like this:

export default function * root () {
  yield [
    // ... snip ....
  ]
}

After changing it to this started to work:


const root = function * root () {
  yield [
    // .... snip ....
  ]
}
export default root

I'm not yet familiar with the ES6 generator functions and require support for them, but at least now I can continue. And have to say that the error were pointing to the place where the invalid export were. I hope this helps someone.

@GantMan
Copy link
Contributor

GantMan commented Jul 6, 2017

@grabbou
Copy link
Contributor

grabbou commented Jul 6, 2017

Wasn't this fixed here? e7c1cf5

@GantMan
Copy link
Contributor

GantMan commented Jul 6, 2017

So this won't roll out till 0.47?

@grabbou
Copy link
Contributor

grabbou commented Jul 6, 2017 via email

@Amurmurmur
Copy link
Author

Tried to fix with the suggested Saga solution, its surely something to do with saga because when I comment out saga implementation in my configureStore, the error is gone however trying suggested solution doesnt work for me. :/

@Amurmurmur
Copy link
Author

Amurmurmur commented Jul 6, 2017

@grabbou @GantMan @ernoaapa
Alright guys, figured out the problem
downgraded babel-preset-react-native form 2.1.0 to 2.0.0 all works fine on Android/iOS
Though once upgraded to 0.46 the error comes back.
As for RN 0.47-rc.0, most packages I have linked, wont work due to some changes to the api of the react-native I guess because they will throw errors such as:

:react-native-blur:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/Users/amurmurmur/exampleapp/node_modules/react-native-blur/android/src/main/java/com/cmcewen/blurview/BlurViewPackage.java:23: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: /Users/amurmurmur/exampleapp/node_modules/react-native-blur/android/src/main/java/com/cmcewen/blurview/BlurringView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
:react-native-blur:compileReleaseJavaWithJavac FAILED

@kcalmes
Copy link

kcalmes commented Jul 7, 2017

@Amurmurmur I am still seeing the issue on 0.45.1 even after downgrading babel. I wonder how much node and npm versions might be affecting which fixes work and which ones don't.
node: v8.1.0
npm: 5.1.0
OS: macOS Sierra 10.12.5

@Amurmurmur
Copy link
Author

@kcalmes Make sure you reset react-native packager after you've downgraded babel with:

npm start -- --reset-cache

@kcalmes
Copy link

kcalmes commented Jul 7, 2017

That did the trick, I previously deleted the node_modules dir, but I didn't realize I missed the other cache. Thanks for your help @Amurmurmur!

@brentvatne
Copy link
Collaborator

@facebook-github-bot close

@facebook-github-bot
Copy link
Contributor

@brentvatne tells me to close this issue. If you think it should still be opened let us know why.

@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Jul 8, 2017
@vongohren
Copy link

Still experiencing this with 0.46.1 and babelrc on both 2.0.0 and 2.1.0. Tried all the things done here but it doesnt fix it. Why was this closed @brentvatne @grabbou

@Amurmurmur
Copy link
Author

Amurmurmur commented Jul 9, 2017

@vongohren Double make sure you reset the packager, Im using react-native 0.46.1 and babel at 2.0.0 all good on both platforms Debug/Release builds.
Please make sure you run

watchman watch-del-all
rm -rf ./node_modules
rm -rf $TMPDIR/react-*
npm i babel-preset-react-native@2.0.0 -D -S
npm install
npm start -- --reset-cache
react-native run-ios

Also make sure you reset your android/ios emulator/simulator, delete both android/ios build folders.

@vongohren
Copy link

vongohren commented Jul 9, 2017

Loool, this is what I have done all the way, but I did not reset the emulator and delete the build folder. Seemed to help, thanks man. But can anyone answere why this happens? @grabbou @brentvatne

Edit: This did solve my android problem, but produces different iOS problems. What are the different clearing options of ios? Clear derivated folders? Pod install again. What else @Amurmurmur ? Im running Cocoapods and swift on iOS

@yabeow
Copy link

yabeow commented Jul 10, 2017

Downgrade babel-preset-react-native to 2.0.0 work for me too. But why 2.1.0 don't work?

@matt-oakes
Copy link
Contributor

Downgrading worked for me, but I'd also like to know what the issue actually is and what a real fix is.

@vongohren
Copy link

Running a completly new project, that is not dependent on cocoapods or swift, works out of the box. I did not try to add all my dependencies but that could be a test case.

@Amurmurmur
Copy link
Author

@vongohren Indeed the fresh project will work for you however once you start using babel features such as export/import you will face the problem with babel-preset-react-native 2.1.0
This is a relevant issue #14933

@poupryc
Copy link

poupryc commented Jul 12, 2017

Same issue here, from react-native version 0.45.1 on Linux subsystem for Windows, downgrading babel-preset and @Amurmurmur's method doesn't work

@Amurmurmur
Copy link
Author

@HelloEdit
But it works, can you share an example project where the problem occurs for you ?
It works fine on my side no matter RN 0.45.1 or 0.46.1 all still.

@tibbus
Copy link

tibbus commented Sep 6, 2017

I had the same issue using 2.1.0 and downgraded to 2.0.0 which fixed the issue.

Now for some reason it doesn't work anymore with 2.0.0 😕

LE : apparently worked after a restart, maybe something was cached...

@Manuelandro
Copy link

@fengshuo thanks, but already tried and didn't work.
I'm with Expo create-react-native-app, maybe it adds some to this issue

@webwelten
Copy link
Contributor

Same here, also coming from Expo create-react-native-app.

@Palisand
Copy link

Palisand commented Sep 6, 2017

@fengshuo @webwelten I believe you are going to have to wait and see if this gets updated in SDK 21, or forbabel-preset-expo to get updated... or you can try and not use the default crna .babelrc and set the preferred babel preset. You will have to account for @expo/vector-icons though; see this comment and the one below it.

@Manuelandro
Copy link

Just to let you know that i solved ejecting from Expo

@arminsal1
Copy link

arminsal1 commented Sep 13, 2017

I'm still having this issue, even after following all of the solutions presented in this thread, including @Amurmurmur 's solution and resetting my terminal / local server, even resetting my computer. It started happening for me after I moved my project root from my user folder to my documents, but the issue persists even if it's moved back so I'm not sure that's the cause.

I can't help but notice my main.jsbundle in xcode is red, which usually indicates it's missing. I'd try to re-add it to my project, but I can't find any resources online that indicate where the main.jsbundle is.

Here's my full Xcode log:

undefined is not an object (evaluating 'regeneratorRuntime.mark')
2017-09-13 11:47:23.171 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'regeneratorRuntime.mark')
2017-09-13 11:47:23.176 [info][tid:com.facebook.react.JavaScript] Running application "APP" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-09-13 11:47:23.176 [error][tid:com.facebook.react.JavaScript] Application APP has not been registered.

Hint: This error often happens when you're running the packager (local dev server) from a wrong folder. For example you have multiple apps and the packager is still running for the app you were working on before.
If this is the case, simply kill the old packager instance (e.g. close the packager terminal window) and start the packager in the correct app folder (e.g. cd into app folder and run 'npm start').

This error can also happen due to a require() error during initialization or failure to call AppRegistry.registerComponent.


2017-09-13 11:47:23.197 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Application APP has not been registered.

Hint: This error often happens when you're running the packager (local dev server) from a wrong folder. For example you have multiple apps and the packager is still running for the app you were working on before.
If this is the case, simply kill the old packager instance (e.g. close the packager terminal window) and start the packager in the correct app folder (e.g. cd into app folder and run 'npm start').

This error can also happen due to a require() error during initialization or failure to call AppRegistry.registerComponent.

Currently running on the latest version of React Native (0.48.3) and the latest babel-preset-react-native (3.0.2).

Also to address the registration complaint, my app has been running fine on previous versions of React Native and I haven't changed the registration code in either my index.ios.js or my index.android.js.

My index.ios.js and index.android.js:

import {
  AppRegistry,
} from 'react-native';

import Home from "./src/Home";

AppRegistry.registerComponent('APP', () => Home);

This should be correct, yeah? So I have no clue why it's suddenly getting this complaint too. Although I suspect it's the result of the first error undefined is not an object (evaluating 'regeneratorRuntime.mark')

@SudoPlz
Copy link
Contributor

SudoPlz commented Sep 15, 2017

I'm using react-native 0.48.3 and what fixed it for me is the following steps:

  1. I created a .babelrc file with the following contents in the root of the project
{
  "presets": ["react-native"]
}
  1. I installed babel-preset-react-native@3.0.2
  2. I ran node node_modules/react-native/local-cli/cli.js start --reset-cache

The problem is now gone.

@arminsal1
Copy link

@SudoPlz How do I create a .babelrc file?

@SudoPlz
Copy link
Contributor

SudoPlz commented Sep 15, 2017

@arminsal1 Open a terminal, cd to your project dir and type touch .babelrc

@arminsal1
Copy link

@SudoPlz Your solution solved my problem, thank you so much!

@SudoPlz
Copy link
Contributor

SudoPlz commented Sep 15, 2017

I'm glad, :)

@eneskaya
Copy link

@SudoPlz, thanks. This did the trick finally. Can you explain also why only after this it starts to work?

jacobtoye added a commit to jacobtoye/react-native-redux-boilerplate that referenced this issue Oct 1, 2017
@deot
Copy link

deot commented Oct 7, 2017

@ernoaapa Thanks

@id77
Copy link

id77 commented Nov 9, 2017

watchman watch-del-all
rm -rf ./node_modules
rm -rf $TMPDIR/react-*
npm i babel-preset-react-native@2.0.0 -D -S
npm install
npm start -- --reset-cache
react-native run-ios

From:
https://stackoverflow.com/questions/45155249/when-using-redux-saga-with-react-native-web-we-get-an-error-cannot-read-propert

ps:
First remove package-lock.json or yarn.lock because other packages may also use babel-preset-react-native, and you can open the lock file to check that they depend on the babel-preset-react-native, which may be the locked version 2.1.0

@csuermann
Copy link

I ran into this error using babel-preset-expo and fixed it by switching to babel-preset-react-native:

yarn add babel-preset-react-native

in .babelrc:

"presets": [
    "babel-preset-react-native"
  ]

@karllson
Copy link

@csuermann Thanks! That worked for me!

@brentvatne
Copy link
Collaborator

what sdk version were you using @csuermann? this shouldn't be a problem with latest version of expo

@csuermann
Copy link

@brentvatne:
"sdkVersion": "21.0.0"

@wvmitchell
Copy link

wvmitchell commented Nov 18, 2017

@brentvatne I am running into the same issue with sdkVersion "22.0.0"

It seems that the version of babel-preset-react-native that babel-preset-expo depends on is 2.1.0. Per what I've read above, this may be causing the problem (and downgrading to 2.0.0 is a potential solution)

Edit:

I was able to get around the issue without changing any dependencies, just had to switch up how I write my sagas:

Went from

function* listenForSignUpUser() {
}

to

const listenForSignUpUser = function* () {
}

willem-h added a commit to willem-h/transit that referenced this issue Nov 19, 2017
`export default function * () {}` can't be used or else it crashes React
Native. See this [issue comment](facebook/react-native#14838 (comment)).
Fadingvision added a commit to Fadingvision/react-native-cloud-music that referenced this issue Nov 24, 2017
@schmaluk
Copy link

I have a bug in the Expo's Font.loadAsync dependency. It uses async and I get this error:
bildschirmfoto 2017-11-28 um 12 06 45
Please help me. Im on time pressure. Thanks

@JulienMalige
Copy link

JulienMalige commented Nov 29, 2017

@SudoPlz
node node_modules/react-native/local-cli/cli.js start --reset-cache + "the sagas export refactoring" work for me !! 😁

"babel-preset-react-native": "^4.0.0",`
"react-native": "^0.50.4",
"react": "16.0.0"

@Pokute
Copy link

Pokute commented Jan 8, 2018

Please note that this also error might also happen with old code (react native 0.44 and about as old babel-preset-react-native) if using Node >= 9.

A fix is to use any Node <9 version which might be a lot easier than upgrading react native.

@angeloocana
Copy link

@Pokute I downgraded Node from 9 to 8, and it worked for me!
Thank you!!!

@facebook facebook locked as resolved and limited conversation to collaborators Aug 23, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests