Resolving Create React App’s “Uncaught ReferenceError: process is not defined”
A recent change to Create React App, or more specifically react-scripts
, has caused hot reloading to throw an error: Uncaught ReferenceError: process is not defined
. This is due to its dependency, react-error-overlay
, being referenced as ^6.0.9
while react-error-overlay
’s latest patch version 6.0.10
is a breaking change. As a result, your installation likely uses 6.0.10
when it needs 6.0.9
. To fix this, you unfortunately need to Frankenstein your yarn.lock
file.
Find your react-error-overlay@^6.0.9
entry, which should have its resolution [incorrectly]set to 6.0.10
:
"react-error-overlay@npm:^6.0.9":
version: 6.0.10
resolution: "react-error-overlay@npm:6.0.10"
checksum: e7384f086a0162eecac8e081fe3c79b32f4ac8690c56bde35ab6b6380d10e6c8375bbb689a450902b6615261fcf6c95ea016fc0b200934667089ca83536bc4a7
languageName: node
linkType: hard
Replace this entry with the following, which resolves to 6.0.9
:
"react-error-overlay@npm:^6.0.9":
version: 6.0.9
resolution: "react-error-overlay@npm:6.0.9"
checksum: 695853bc885e798008a00c10d8d94e5ac91626e8130802fea37345f9c037f41b80104345db2ee87f225feb4a4ef71b0df572b17c378a6d397b6815f6d4a84293
languageName: node
linkType: hard
Once saved, run yarn install
again to pull the correct version into your node_modules
and/or .yarn/cache
directory. Your React application should now hot reload correctly.
To track this error in an official capacity, you can view this issue on GitHub.