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)
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/helpersis ^7.5.4@guidorubin Forcing resolution of
@babel/plugin-proposal-object-rest-spreadto7.4.4worked for us as suggested by @gorkalaucirica https://github.com/babel/babel/issues/10166#issuecomment-508732941 We are usingyarnso we were able to use the selective dependency resolutions feature by adding the following to ourpackage.jsonI have just released v7.5.3, which should fix the
Property descriptor must be an objecterror. Theundefined is not a functionerror has been fixed in v7.5.2.Please check in your lockfile that all these packages have been updated:
If you are using yarn, you can run
yarn upgrade -s @babelto 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/helpersand/or@babel/runtimeare 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-spreadto7.4.4inpackage.jsonI have same issue.
@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.
Same result for me :
EDIT : my
package-lock.jsoncontains"@babel/runtime" v7.5.2Yeah it looks the same bug. I will release it as soon as #10174 is resolved.
What’s your
package-lock.jsonfile?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.
arguments)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_moduleswith thepackage-lock.jsonin 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.Object.getOwnPropertyDescriptorsis not supported on Node.js until 7.0.0. AsBabel 7works onNode >= 6.9.0, ideallybabel-preset-envshould 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 ?