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

'babelHelpers.asyncToGenerator is not a function' error only on iOS #16333

Closed
NathHorrigan opened this issue Oct 12, 2017 · 6 comments
Closed
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@NathHorrigan
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

No

Environment

Environment:
OS: macOS Sierra 10.12.1
Node: 7.9.0
Yarn: 0.20.3
npm: 4.2.0
Watchman: 4.9.0
Xcode: Xcode 8.3.3 Build version 8E3004b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: 0.48.3 => 0.48.3

Target Platform: iOS (10.3) Android

Expected Behavior

App to load as it does on android .

Actual Behavior

Error: babelHelpers.asyncToGenerator is not a function

iOS Simulator (10.3 @ iPhone 6)

@Leko
Copy link
Contributor

Leko commented Dec 9, 2017

I got same error in react-native 0.50.4.
I think that babelHelpers.asyncToGenerator is missing in Libraries/polyfills/babelHelpers.js, right ?

It works fine after add babelHelpers.asyncToGenerator to Libraries/polyfills/babelHelpers.js.
(It is partial of require('babel-core').buildExternalHelpers('asyncToGenerator'.split(' ')).)

babelHelpers.asyncToGenerator = function (fn) {
  return function () {
    var gen = fn.apply(this, arguments);
    return new Promise(function (resolve, reject) {
      function step(key, arg) {
        try {
          var info = gen[key](arg);
          var value = info.value;
        } catch (error) {
          reject(error);
          return;
        }

        if (info.done) {
          resolve(value);
        } else {
          return Promise.resolve(value).then(function (value) {
            step("next", value);
          }, function (err) {
            step("throw", err);
          });
        }
      }

      return step("next");
    });
  };
};

It is bug ? I made a mistake ?

@stale
Copy link

stale bot commented Feb 7, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 7, 2018
@joeyfigaro
Copy link

Also having issues with this. Using babel-preset-react-native makes no difference, unfortunately.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 9, 2018
@joeyfigaro
Copy link

joeyfigaro commented Feb 9, 2018

.babelrc

{
	"presets": [
		"expo",
		"react-native"
	],
	"plugins": [
		"transform-react-jsx-source",
		"transform-function-bind",
		["module-resolver", {
			"root": ["./"],
			"alias": {
				"root": ".",
				"src": "./src",
				"components": "./src/components",
				"modals": "./src/modals",
				"screens": "./src/screens",
				"api": "./src/api",
				"redux": "./node_modules/redux",
				"@redux": "./src/_redux",
				"utils": "./src/utils",
				"assets": "./src/assets",
				"tests": "./src/__tests__",
				"tests/components": "./src/components/__tests__",
				"tests/redux": "./src/_redux/__tests__"
			},
			"extensions": [".js", ".ios.js", ".android.js"]
		}]
	],
	"env": {
		"test": {
			"presets": [
				"react-native"
			]
		}
	}
}

package.json

{
        ...
	"dependencies": {
		"color": "^2.0.1",
		"expo": "^25.0.0",
		"moment": "^2.20.1",
		"prop-types": "^15.6.0",
		"ramda": "^0.25.0",
		"ramda-extension": "^0.2.1",
		"react": "^16.2.0",
		"react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz",
		"react-native-actionsheet": "^2.3.0",
		"react-native-communications": "^2.2.1",
		"react-native-datepicker": "^1.6.0",
		"react-native-elements": "^0.18.5",
		"react-native-iphone-x-helper": "^1.0.1",
		"react-native-pathjs-charts": "0.0.33",
		"react-native-swipeable": "^0.6.0",
		"react-native-swiper": "^1.5.13",
		"react-navigation": "^1.0.0-beta.27",
		"react-redux": "^5.0.6",
		"react-search-input": "^0.11.3",
		"redux": "^3.7.2",
		"redux-api-middleware": "^2.2.0",
		"redux-logger": "^3.0.6",
		"redux-persist": "^5.4.0",
		"redux-thunk": "^2.2.0",
		"reselect": "^3.0.1"
	},
	"devDependencies": {
		"babel-eslint": "^8.2.1",
		"babel-plugin-module-alias": "^1.6.0",
		"babel-plugin-transform-react-jsx-source": "^6.22.0",
		"babel-plugin-module-resolver": "^3.0.0",
		"babel-plugin-transform-function-bind": "^6.22.0",
		"babel-preset-env": "^1.6.1",
		"babel-preset-react-native": "^4.0.0",
		"eslint": "^4.15.0",
		"eslint-config-airbnb": "^16.1.0",
		"eslint-import-resolver-babel-module": "^4.0.0",
		"eslint-loader": "^1.9.0",
		"eslint-plugin-import": "^2.8.0",
		"eslint-plugin-jsx-a11y": "^6.0.3",
		"eslint-plugin-react": "^7.5.1",
		"eslint-plugin-react-native": "^3.2.0",
		"jest-expo": "^25.0.0",
		"quokka-signet-explorer": "^1.3.0",
		"remote-redux-devtools": "^0.5.12"
	}
}

@joeyfigaro
Copy link

joeyfigaro commented Feb 9, 2018

After doing the dependency + cache nuking a handful of times it started to work again.

- removed node_modules
- cleared $TMPDIR files/directories
- cleared yarn cache
- reinstall dependencies
- opened XDE
- turned on development mode and restarted project
- turned off development mode and restarted project

update: we're back to having issues again. Looks like the only thing that currently works is to update the polyfill in Libraries, as suggested by @Leko

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. labels Feb 24, 2018
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 24, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Feb 25, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 25, 2019
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

4 participants