2
votes

I tried upgrading react scripts to 4.0.1 and type script to "4.1.3" and react to "17.0.1". I deleted the node_modules and lock files, then installed again with yarn install command. When I run yarn start, I get error ReferenceError: Cannot access 'middleware' before initialization

enter image description here

When I set FAST_REFRESH=false in .env file app loads with no issues, So it is something with react refresh

1
Would you please share a screenshot of the error? - JIGNESH PATEL
updated with screenshot - Sowmya
Please post text, not images of text. - Dave Newton
When I set FAST_REFRESH=false in .env file app loads with no issues, So it is something with react refresh - Sowmya
Any help here is greatly appreciated - Sowmya

1 Answers

1
votes

It's a known issue https://github.com/facebook/create-react-app/issues/9904. It has to do with a change in Create React App. Fast Refresh, or React Refresh is about to replace Hot Reload. By default FAST_REFRESH is set to true.

For now I stick to Hot Reload, by setting FAST_REFRESH=false as you did and track the issue given above.