You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeError: Cannot read property 'forEach' of undefined if object destructing with rest props is used #7753
Compilation fails with TypeError: Cannot read property 'forEach' of undefined if object destructing with rest props is used in npx 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.3
Which terms did you search for in User Guide?
TypeError: Cannot read property 'forEach' of undefined
Failed to compile.
./src/App.js
TypeError: Cannot read property 'forEach' of undefined
Reproducible demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Reacted by Julian Dominguez-Schatz, Luke Peters, Tomas, Gurpreet Singh, smogili1, Minan, Evan, Stuart Casarotto, Michael Martinez, Alain Dimabuyo and 61 more
Reacted by Alain Dimabuyo, K.Shintani, Pavel Tiunov, nantawat chairat, Neeraj Sharma, Robert Darek Ganko, Minan, Florent, Daniel Botka, robotr and 12 more
Reacted by Rodrigo Gomes, nantawat chairat, Sanj Ambalavanar, robotr and Koleman Nix
i was working on a project for one week, with react-scripts version 3.0.1 with no errors, and today when i start my project i got this related error, what is the explanation for this? react-scripts connect to a external server when i run yarn start ???? this is insane
PS: downgrading to version 3.0.1 solved 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 eslint@6.5.0 again and got same compile error.
So working with:
"eslint": "^6.4.0",
"react": "^16.10.1",
"react-dom": "^16.10.1",
"react-router-dom": "^5.1.1",
"react-scripts": "^3.1.2",
Reacted by noahfinkso, Matthew Costabile and Praveen Venigalla
We're having this same issue, same error message, and it's breaking the whole build 😲!
Tried downgrading to react-scripts: 3.0.1 but that's not quite working yet...
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 react-scripts
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 react-scripts
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 npm outdated and upgrade packages one by one to find the culprit. I can confirm, however, that updating package.json to 3.0.1 and rolling back allowed my application to compile and nixed the forEach issue. My application is based on npm and create-react-app.
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.
Activity
gurpreetsingh2410 commentedon Sep 29, 2019
smogili1 commentedon Sep 29, 2019
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.
iMerica commentedon Sep 30, 2019
Downgrading React Scripts to 3.0.1 worked for me.
alaindimabuyo commentedon Sep 30, 2019
@iMerica downgrading also worked for me
rodgomesc commentedon Sep 30, 2019
i was working on a project for one week, with
react-scriptsversion 3.0.1 with no errors, and today when i start my project i got this related error, what is the explanation for this?react-scriptsconnect to a external server when i runyarn start???? this is insanePS: downgrading to version 3.0.1 solved the problem
smogili1 commentedon Sep 30, 2019
you must have done yarn install which would have upgraded based on your package.json settings.
rodgomesc commentedon Sep 30, 2019
No, in all commits, version of react Scripts never change, i Just checkout a old commits to check
amayatsky commentedon Sep 30, 2019
3.1.1 is working fine for me while 3.1.2 doesn't.
Gr8z commentedon Sep 30, 2019
npm i react-scripts@3.0.1Downgrade to 3.0.1
mattisdada commentedon Sep 30, 2019
+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....
janprasil commentedon Sep 30, 2019
I had the same issue, also downgraded to 3.0.1
ncolliva commentedon Sep 30, 2019
downgrading to version 3.0.1 seems to solve the problem!
oyof8376 commentedon Sep 30, 2019
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 eslint@6.5.0 again and got same compile error.
So working with:
"eslint": "^6.4.0",
"react": "^16.10.1",
"react-dom": "^16.10.1",
"react-router-dom": "^5.1.1",
"react-scripts": "^3.1.2",
25 remaining items
minor style changes
ahrbil commentedon Sep 30, 2019
I have the same issue and I just spent the whole day debugging it.
downgrading to react-scripts: 3.0.1 worked for me.
naeohmi commentedon Sep 30, 2019
We're having this same issue, same error message, and it's breaking the whole build 😲!
Tried downgrading to react-scripts: 3.0.1 but that's not quite working yet...
avindra commentedon Sep 30, 2019
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
react-scriptsrichardhertzog commentedon Sep 30, 2019
node 10.16.3 react 16.9.0 react-scripts 3.0.1 eslint 6.1.0 babel/core 7.6.2Is working for me using npm with no resolutions.
Fix react-scripts build error
gurpreetsingh2410 commentedon Sep 30, 2019
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.
babalugats76 commentedon Sep 30, 2019
Ouch! I lost a whole day to this, having to methodically run
npm outdatedand upgrade packages one by one to find the culprit. I can confirm, however, that updatingpackage.jsonto3.0.1and rolling back allowed my application to compile and nixed theforEachissue. My application is based onnpmandcreate-react-app.Minor fixes to 2019 update (#359)
2019 upgrade (#360)
ianschmitz commentedon Sep 30, 2019
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.
ianschmitz commentedon Oct 1, 2019
We've got a fix in and should be releasing in the next few hours hopefully. Thanks for your patience!