facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
117.72k stars 24.16k forks source link

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

Closed azcodia closed 5 years ago

azcodia commented 5 years ago

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

punyasurya commented 5 years ago

have the same issue here...

thaitrandng commented 5 years ago

have the same issue here... =))

luolin2611 commented 5 years ago

Same problem

gabsima-nexapp commented 5 years ago

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..

react-native-bot commented 5 years ago

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.

LuongTruong commented 5 years ago

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

rodolphefauquez commented 5 years ago

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...

luolin2611 commented 5 years ago

Same problem

image

LuongTruong commented 5 years ago

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

mikecobas commented 5 years ago

same problem

smallrig commented 5 years ago

same problem

luolin2611 commented 5 years ago

@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’t go.

battajegroup commented 5 years ago

exact same issue..

congnt148 commented 5 years ago

Same problem

Jay-flow commented 5 years ago

same problem

melodion commented 5 years ago

same problem

LuongTruong commented 5 years ago

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

mohammed-fahad commented 5 years ago

image Same issue here.

JintoAntony commented 5 years ago

Same issue here.

liuqing520it commented 5 years ago

restart your computer to solve this problem

nativeaditya commented 5 years ago

Same issue here.

carlmagumpara commented 5 years ago

same problem here

aldy010 commented 5 years ago

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

PIlepRusel commented 5 years ago

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

ken-talkingsource commented 5 years ago

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

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

huiruo commented 5 years ago

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

aldy010 commented 5 years ago

still no fix yet, tried the above solution

mohsincox commented 5 years ago

I restarted my computer, but did not solve the problem

GantMan commented 5 years ago

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
sunnylqm commented 5 years ago

@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.

rolignu2 commented 5 years ago

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

ashishmundra commented 5 years ago

same issue here

rolignu2 commented 5 years ago

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

sunnylqm commented 5 years ago

@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

mgwidmann commented 5 years ago

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

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

rolignu2 commented 5 years ago

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

Jay-flow commented 5 years ago

@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;
rahul356357 commented 5 years ago

@Army-92 solution works fine for me

itgou commented 5 years ago

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.

sunnylqm commented 5 years ago

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

bepehr commented 5 years ago

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

XieTongXue commented 5 years ago

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

raghulvaikundam commented 5 years ago

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

xinchanghao commented 5 years ago

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...

xinchanghao commented 5 years ago

Retry react-native init name,it's ok!

raghulvaikundam commented 5 years ago

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

Dafa-Alla commented 5 years ago

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

kelset commented 5 years ago

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.