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

Created on 22 Jan 2019  路  48Comments  路  Source: facebook/react-native

before it went smoothly, but after I made native react a new error occurred,
this is the problem
"undefined is not a function (evaluation 'object.getOwnPropertyDescriptors (arguments [i])')"

even though the code is not I add a little bit of input
and that makes me crazy

Ran Commands Locked 馃摝Bundler

Most helpful comment

Ok guys , i have a temporaly fix ,

go to

node_modules/@babel/runtime/helpers/objectSpread.js

find the LINE OF CODE :

Object.defineProperties(target, Object.getOwnPropertyDescriptors(arguments[i]));

Replace the line with this code:

     var source = arguments[i] != null ? arguments[i] : {};
      var ownKeys = Object.keys(source);

      if (typeof Object.getOwnPropertySymbols === 'function') {
        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
        }));
      }

      ownKeys.forEach(function (key) {
        defineProperty(target, key, source[key]);
      });

I HOPE I CAN HELP US, THIS IS THE UNIQUE METHOD WHAT WORKS

All 48 comments

have the same issue here...

have the same issue here... =))

Same problem

I've updated from react native 0.55 to 0.57 and i get this error on android while on ios everything works fine.

I've updated the dependencies in gradle in order to be able to build but i still get the error..


We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.

please re-open this issue, I have the same problem like them :(

Same problem here, android only, without reason (it was working few hours ago for me).
But the error disappear if i enable the 'debug JS remotely' option...

Same problem

image

@luolin2611 , that is it. I create a complete new project but the error appear at the first time running the project.

same problem

same problem

@luolin2611 , that is it. I create a complete new project but the error appear at the first time running the project.

.

I also run the error for the first time, and I can鈥檛 go.

exact same issue..

Same problem

same problem

same problem

I've updated from react native 0.55 to 0.57 and i get this error on android while on ios everything works fine.

I've updated the dependencies in gradle in order to be able to build but i still get the error..

Thanks @gabsima-nexapp , I move to iOS project to continue my work first and deal with Android later

image
Same issue here.

Same issue here.

restart your computer to solve this problem

Same issue here.

same problem here

I have exactly the same error here. my region is in Indonesia
react native 0 57 error
react native new project

restart your computer to solve this problem
does this fix the problem ?

restart your computer to solve this problem
does this fix the problem ?

I restarted (my mac) but didn't solve this problem.

react native undefined is not an object(evaluating 'Object.getOwnPropertyDescriptors(arguments[i])')

still no fix yet, tried the above solution

I restarted my computer, but did not solve the problem

I have a terrible fix.

I guessed that the problem was some kind of dependency upgrade, and because React Native does not come locked to working versions, something got published and broke it.

I grabbed a yarn.lock from a project from over the weekend, pasted that into my project's yarn.lock file and then did yarn at the command line to have it automatically prune/lock things back up. Somewhere in that mess, it grabbed the right stuff and now I can use Android again. Not a great fix, but hopefully it helps!

TL:DR;

  1. Copy this yarn.lock contents https://gist.github.com/GantMan/347fb4206fa7be141ff7133ba4859afd
  2. Past it over your project's yarn.lock contents
  3. run yarn in the CLI

@GantMan I just did the same thing. I saw mainly babel update when diffing a working version and a broken version. It is hard to tell what deps cause the break, so the best option is definitely to use a whole working lock file.

please , reopen the issue. i have the same problem it probably because the object.getOwnPropertiesDescriptor doesn't exists anymore, the same happended on
react-native-keyboard-aware-scroll-view, the problem is on

node_modules/@babel/runtime/helpers/objectSpread.js

Object.defineProperties(target, Object.getOwnPropertyDescriptors(arguments[i]));

but i don't know how i can solve

same issue here

Ok guys , i have a temporaly fix ,

go to

node_modules/@babel/runtime/helpers/objectSpread.js

find the LINE OF CODE :

Object.defineProperties(target, Object.getOwnPropertyDescriptors(arguments[i]));

Replace the line with this code:

     var source = arguments[i] != null ? arguments[i] : {};
      var ownKeys = Object.keys(source);

      if (typeof Object.getOwnPropertySymbols === 'function') {
        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
        }));
      }

      ownKeys.forEach(function (key) {
        defineProperty(target, key, source[key]);
      });

I HOPE I CAN HELP US, THIS IS THE UNIQUE METHOD WHAT WORKS

@rolignu2 Thanks for locating the line, so I guess this pr of babel-helpers cause the problem. It forgot to check this function in else branch. Please fix this asap @hzoo @saschanaz

Workaround

Add the following to your package.json:

  "resolutions": {
    "@babel/helpers": "7.2.0",
    "@babel/runtime": "7.2.0"
  }

Then run rm -rf node_modules && yarn && yarn start --reset-cache

@sunnylqm Wow merged 10 hours ago... Sad that the NPM world is like this.

https://github.com/babel/babel/pull/9341

@sunnylqm thanks man to apply the revert.
@azcodia please close the issue. everything works well

@rolignu2 Thanks for locating the line
I refer to the project I used before.
It is work for me.
node_modules/@babel/runtime/helpers/objectSpread.js
Replace with the code below in the path above.

var defineProperty = require("./defineProperty");

function _objectSpread(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};
    var ownKeys = Object.keys(source);

    if (typeof Object.getOwnPropertySymbols === 'function') {
      ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
        return Object.getOwnPropertyDescriptor(source, sym).enumerable;
      }));
    }

    ownKeys.forEach(function (key) {
      defineProperty(target, key, source[key]);
    });
  }

  return target;
}

module.exports = _objectSpread;

@Army-92 solution works fine for me

I have a terrible fix.

I guessed that the problem was some kind of dependency upgrade, and because React Native does not come locked to working versions, something got published and broke it.

I grabbed a yarn.lock from a project from over the weekend, pasted that into my project's yarn.lock file and then did yarn at the command line to have it automatically prune/lock things back up. Somewhere in that mess, it grabbed the right stuff and now I can use Android again. Not a great fix, but hopefully it helps!

TL:DR;

  1. Copy this yarn.lock contents https://gist.github.com/GantMan/347fb4206fa7be141ff7133ba4859afd
  2. Past it over your project's yarn.lock contents
  3. run yarn in the CLI

Thank you, it solved this problems of mine.

Babel just published a hotfixed version. Just remove your yarn.lock and yarn and this issue should be gone.

@sunnylqm solution worked for me , just add that lines to package.json , and run yarn then run react-native run-android

same problem, i delete the demo and run react-native init AwesomeProject again, fixed.

run npm install in the project directory to fix the issue. This command will install the missed dependency for the react native project

run npm install in the project directory to fix the issue. This command will install the missed dependency for the react native project

i tried it, it didn't work...

Retry react-native init name锛宨t's ok!

run npm install in the project directory to fix the issue. This command will install the missed dependency for the react native project

i tried it, it didn't work...

maybe u check with your package.json. Tried with latest react-native version 0.57

I solve this proplem now

1-Delete the old project and create a new project
聽2-Then open the cmd for the project path and type
3-npm istall
Then
4-react-native init AwesomeProject
5- react-native run-android

Hey everyone, looks like this was a Babel issue - they should have published an hotfix on their side already, in the meantime to avoid too much noise I'll lock this issue.

~A workaround can be found here - thanks @sunnylqm 馃憤~


EDIT: the breaking change was reverted in https://github.com/babel/babel/pull/9379 and released in: https://github.com/babel/babel/releases/tag/v7.3.1

Anyone facing this issue simply needs to nuke yarn lock etc.

Was this page helpful?
0 / 5 - 0 ratings