4.0 alpha - TypeError: Cannot add property noFallthroughCasesInSwitch, object is not extensible
See original GitHub issueDescribe the bug
I updated a typescript CRA project (previously on ^3.4.0
react-scripts version) to use react-scripts “next” version to try out 4.0 alpha (following https://gist.github.com/iansu/282dbe3d722bd7231fa3224c0f403fa1), but encountered this error when running yarn start
yarn run v1.22.4
$ craco start
/Users/kwuang/github/suma-web/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js:210
appTsConfig.compilerOptions[option] = suggested;
^
TypeError: Cannot add property noFallthroughCasesInSwitch, object is not extensible
at verifyTypeScriptSetup (/Users/kwuang/github/suma-web/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js:210:45)
at Object.<anonymous> (/Users/kwuang/github/suma-web/node_modules/react-scripts/scripts/start.js:31:1)
at Module._compile (internal/modules/cjs/loader.js:1151:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (internal/modules/cjs/helpers.js:72:18)
at start (/Users/kwuang/github/suma-web/node_modules/@craco/craco/lib/cra.js:202:5)
at Object.<anonymous> (/Users/kwuang/github/suma-web/node_modules/@craco/craco/scripts/start.js:27:1)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Did you try recovering your dependencies?
(Write your answer here.)
Which terms did you search for in User Guide?
(Write your answer here if relevant.)
Environment
Environment Info:
current version of create-react-app: 3.4.1
running from /Users/kwuang/github/suma-web/node_modules/create-react-app
System:
OS: macOS 10.15.3
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 13.7.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.13.6 - /usr/local/bin/npm
Browsers:
Chrome: 84.0.4147.105
Firefox: 74.0.1
Safari: 13.0.5
npmPackages:
react: ^16.13.1 => 16.13.1 (16.12.0)
react-dom: ^16.13.1 => 16.13.1 (16.12.0)
react-scripts: next => 4.0.0-next.77+3d74b79d
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
(Write your steps here:)
- change to
next
version of react-scripts inpackage.json
yarn
to install new depsyarn start
Expected behavior
Expected yarn start
to work as before.
Actual behavior
Has console output (see above).
Reproducible demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:154
- Comments:52 (3 by maintainers)
Top Results From Across the Web
Error when updating create-react-app to 4.0 with typescript ...
compilerOptions[option] = suggested; ^ TypeError: Cannot add property noFallthroughCasesInSwitch, object is not extensible at ...
Read more >TypeError: can't define property "x": "obj" is not extensible
The JavaScript exception "can't define property "x": "obj" is not extensible" occurs when Object.preventExtensions() marked an object as no ...
Read more >cannot add property object is not extensible react
useEffect(() => { 4.0 alpha - TypeError: Cannot add property noFallthroughCasesInSwitch, object is not extensible. Please, don't make it harder than it is ......
Read more >Cannot Add Property Effecttag, Object Is Not Extensible
To fix this error, you will either need to remove the call to Object. preventExtensions() entirely, or move it to a position so...
Read more >Andrew Byrd (@WordyTheByrd) / Twitter
If you edit /etc/pam.d/sudo and add the following line to the top… auth ... 4.0 alpha - TypeError: Cannot add property noFallthroughCasesInSwitch, object...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to sidestep this error by adding
"noFallthroughCasesInSwitch": true
tocompilerOptions
in mytsconfig.json
(which I think just avoids the need for this code to run at all).I also got that too. Just figured out that I have to change
"compilerOptions.jsx"
from"preserve"
to"react"
.