babel: undefined is not a function(evaluation 'object.getOwnPropertyDescriptors(arguments[i])')

https://github.com/facebook/react-native/issues/23092

Unfortunately this exact same issue strikes again with the release of Babel v7.5.0.

These are the Babel related dependencies I am having:

    "@babel/core": "7.4.5",
    "@babel/plugin-proposal-class-properties": "7.4.4",
    "@babel/plugin-proposal-decorators": "7.4.4",
    "@babel/plugin-transform-flow-strip-types": "7.4.4",
    "@babel/preset-flow": "7.0.0",
    "babel-eslint": "10.0.2",
    "babel-jest": "24.8.0",
    "metro-react-native-babel-preset": "0.54.1",

With the package-lock.json I generated a few days ago everything’s fine with npm install, but if I try to do it without the lockfile the error appears. Judging from my lockfile’s diff I can say that a few secondary Babel dependencies were updated to v7.5.0 without the lockfile (eg. @babel/generator, @babel/helper-create-class-features-plugin) so am pretty sure this is a Babel issue again.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 20
  • Comments: 91 (26 by maintainers)

Most upvoted comments

Published as 7.5.4! I have also published @babel/core (even if it didn’t contain any change), so that you can update it to be sure that @babel/helpers is ^7.5.4

@guidorubin Forcing resolution of @babel/plugin-proposal-object-rest-spread to 7.4.4 worked for us as suggested by @gorkalaucirica https://github.com/babel/babel/issues/10166#issuecomment-508732941 We are using yarn so we were able to use the selective dependency resolutions feature by adding the following to our package.json

"resolutions": {
  "@babel/plugin-proposal-object-rest-spread": "7.4.4"
}

I have just released v7.5.3, which should fix the Property descriptor must be an object error. The undefined is not a function error has been fixed in v7.5.2.

Please check in your lockfile that all these packages have been updated:

 - @babel/helpers => 7.5.3
 - @babel/plugin-proposal-object-rest-spread => 7.5.3
 - @babel/preset-env-standalone => 7.5.3
 - @babel/preset-env => 7.5.3
 - @babel/runtime-corejs2 => 7.5.3
 - @babel/runtime-corejs3 => 7.5.3
 - @babel/runtime => 7.5.3
 - @babel/standalone => 7.5.3

If you are using yarn, you can run yarn upgrade -s @babel to update them.

If it still doesn’t work, please update your lockfile in a gist and share it.

7.5.2 released! Please check that in your lockfile @babel/helpers and/or @babel/runtime are v7.5.2 🙂

Please wait until 7.5.2 is released (there is till a pending PR, I hope to get it finished today).

Ohhhhh I managed to reproduce it using node 4. It’s my fault, I’m sorry 😅

Fixed locking @babel/plugin-proposal-object-rest-spread to 7.4.4in package.json

I have same issue.

"@babel/core": "^7.5.5",
 "@babel/helpers": "^7.5.5",
 "@babel/runtime": "^7.5.5",
 "metro-react-native-babel-preset": "^0.55.0",
 "babel-eslint": "10.0.2",

@nicolo-ribaudo Like this?

“devDependencies”: { “babel-jest”: “24.8.0”, “jest”: “24.8.0”, “metro-react-native-babel-preset”: “0.55.0”, “react-test-renderer”: “16.6.3”, “@babel/runtime”: “7.5.4”, “@babel/core”: “7.5.4”, “@babel/helpers”: “7.5.4” }

I’ve changed and run npm install again then react-native run-android but still occur that error 😦

We have a solution!

While waiting for a fix, we’ve configure object-rest-spread to use loose option.

            plugins: [
                    ...,
                    ['@babel/plugin-proposal-object-rest-spread', {
                        loose: true
                    }],
                    ...
            ]

Thanks for the help @nicolo-ribaudo! I have @babel/helpers and @babel/runtime both as v7.5.2 in my lockfile, but now I’m getting the error “Property description must be an object.” Any help is much appreciated.

Same result for me :

Capture d’écran 2019-07-08 à 23 21 44

EDIT : my package-lock.json contains "@babel/runtime" v7.5.2

Yeah it looks the same bug. I will release it as soon as #10174 is resolved.

What’s your package-lock.json file?

thank you @nicolo-ribaudo

It’s working for us

Great we can make a release very soon then! Thanks for all your patience everyone! We are all learning here (and also I believe Nicolò is studying for exams even).

I think we can do a writeup on some of the issues we’ve encountered here later as well, and hopefully that’s useful to everyone.

  • ES6+ code actually helps fix bugs (…spread instead of arguments)
  • We currently don’t use ES6+ in Babel’s helpers because we need the helpers themselves to be transpilable (hopefully soon: related to my post but we ideally want ES6+ source in your own app code, your dependencies, and babel’s own helpers too)
  • Versioning is hard

Wohoooo ❤️

@nicolo-ribaudo This problem has plagued me for a few days, I hope to solve it as soon as possible, thank you!

Facing same issue here. I have also downgraded babel-core to lower version (6.26.3) but due to some third party libraries using @babel/core internally, package-lock.json still contains @bable/core: 7.5.0. It looks like this: "@babel/core": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.5.0.tgz", "requires": { "@babel/code-frame": "^7.0.0", "@babel/generator": "^7.5.0", "@babel/helpers": "^7.5.0", "@babel/parser": "^7.5.0", "@babel/template": "^7.4.4", "@babel/traverse": "^7.5.0", "@babel/types": "^7.5.0", "convert-source-map": "^1.1.0", "debug": "^4.1.0", "json5": "^2.1.0", "lodash": "^4.17.11", "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" }, "dependencies": { "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "requires": { "ms": "^2.1.1" } }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", } } },

@LucaMele for sure, I’v deleted node_modules with the package-lock.json in addition ! I’ve also upgraded all packages but I get same result…

A hotfix would be to add the following to your polyfill.js, note that it is different to *get-own-property-descriptor.

import 'core-js/modules/es6.object.get-own-property-descriptors';

Object.getOwnPropertyDescriptors is not supported on Node.js until 7.0.0. As Babel 7 works on Node >= 6.9.0, ideally babel-preset-env should take care of this. I am investigating this issue and hopefully I will work on a fix later.

@gorkalaucirica Can you please share your entire package.json here ?