-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
TypeError: Cannot read property 'forEach' of undefined if object destructing with rest props is used #7753
Comments
This comment has been minimized.
This comment has been minimized.
Ran into the same issue and spent half a day debugging. Saw this issue and switched to a prior version and it seems to work like a charm. |
Downgrading React Scripts to 3.0.1 worked for me. |
@iMerica downgrading also worked for me |
i was working on a project for one week, with PS: downgrading to version 3.0.1 solved the problem |
you must have done yarn install which would have upgraded based on your package.json settings. |
No, in all commits, version of react Scripts never change, i Just checkout a old commits to check |
3.1.1 is working fine for me while 3.1.2 doesn't. |
Downgrade to 3.0.1 |
+1 I also had to downgrade to 3.0.1. 3.1.2 & 3.1.1 (I didn't try 3.1.0) both failed.... |
I had the same issue, also downgraded to 3.0.1 |
downgrading to version 3.0.1 seems to solve the problem! |
I had the same problem but found that reverting eslint to 6.4.0 from the simultaneous update to 6.5.0 solved the problem. Tried to npm i [email protected] again and got same compile error. |
ESLint bug: eslint/eslint#12335 |
+1 getting same issue. Same code was working on Friday. Its caused after npm install and updated packages version. You can downgrade react-script version to 3.0.1 to fix this. But looks like issue is in eslint. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Had the same issue.
|
+1 Same issue, downgrading react-scripts to 3.0.1 mitigates the problem. |
In my case, After downgrading to 3.0.1, I was getting Error: Cannot find module '@csstools/normalize.css. So I uninstalled @csstools/normalize.css and reinstalled @csstools/normalize.css and it worked. |
This comment has been minimized.
This comment has been minimized.
The issue is definitely Until that merge gets included, adding the following to package.json worked for me
|
Worked for me on my ejected project. Thanks @oyof8376 |
locking eslint at 6.4.0 in devDependencies fixes this on my end (at least until the pr referecned above is released). 6.5.0 fails |
This seems similar to #7566 where yarn users had to override Can anyone think of a way we can test for this problems? Maybe have the linter portion run in the builds for |
Ugh. Everything was working on Friday, then I upgraded to So I reverted back to my FWIW, I don't explicitly have |
So yeah, now I've rolled all the way back to react-script 3.0.1, and things are up and running again. But I have no idea why things ever worked with any version beyond 3.0.1. is there some sort of global install that's happening under the hood here? |
Yes, it is a bug with eslint-loader, but it is a design flaw in CRA to give a linter enough importance that it can break core development functionality. |
@iMerica Ah, I see that above now. Is this because
...and so it's grabbing whatever the newest version of FWIW, I've removed all of those |
See facebook/create-react-app#7753 for more info
upgrade react dependencies - except react-scripts which currently has an issue with eslint facebook/create-react-app#7753
I have the same issue and I just spent the whole day debugging it. |
We're having this same issue, same error message, and it's breaking the whole build 😲! |
Do npm users have a way to control dependency resolutions yet? As mentioned earlier in this thread, there is a working solution for yarn users: #7753 (comment) without having to completely downgrade |
|
./src/components/PageWrapper.js TypeError: Cannot read property 'forEach' of undefined was being thrown during build. According to a github issue downgrading is the solution facebook/create-react-app#7753
I am also using npm. I resolved quickly it by deleting package.json, removing node modules directory and package-lock.json and installing back again. |
Ouch! I lost a whole day to this, having to methodically run |
* Fix react-scripts build error ./src/components/PageWrapper.js TypeError: Cannot read property 'forEach' of undefined was being thrown during build. According to a github issue downgrading is the solution facebook/create-react-app#7753 * Fix issue text colours * Fixed npm typo * Unignored package-lock.json
* Update for 2019 * Add grace period support. This year there is a 1 week grace period before a PR counts, this commit adds support for this by displaying 'pending' next to any that are less than a week old. * Add thanks yo digital ocean and dev to * Minor fixes to 2019 update (#359) * Fix react-scripts build error ./src/components/PageWrapper.js TypeError: Cannot read property 'forEach' of undefined was being thrown during build. According to a github issue downgrading is the solution facebook/create-react-app#7753 * Fix issue text colours * Fixed npm typo * Unignored package-lock.json
Going to lock this for now to prevent email spam to those subscribed. If anyone could spare some time to try to sort out the CI error in the Linux runs over at #7754 that would be greatly appreciated. We'll post back here when we have a fix ready to go out. |
We've got a fix in and should be releasing in the next few hours hopefully. Thanks for your patience! |
Describe the bug
Compilation fails with
TypeError: Cannot read property 'forEach' of undefined
if object destructing with rest props is used innpx
created app.Works with yarn though.
Versions of react-scripts affected: 3.1.0, 3.1.1 (with different error messages), 3.1.2
Most recent react-scripts version that works: 3.0.1
Did you try recovering your dependencies?
npm --version
: 6.11.3Which terms did you search for in User Guide?
TypeError: Cannot read property 'forEach' of undefined
Environment
(paste the output of the command here.)
Steps to reproduce
(Write your steps here:)
$ npx create-react-app error-test
. Make sureyarn
is not installed.error-test/src/App.js
and add following code to the end of the file:$ npm start
fromerror-test
directoryExpected behavior
Application is compiled correctly
Actual behavior
Compilation failed with message:
Reproducible demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
The text was updated successfully, but these errors were encountered: