-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Issue running "react-scripts": "4.0.0" with typescript 4.1 beta and 4.1.0-dev.20201029 #9960
Comments
The release notes state TypeScript 4 is supported and the TypeScript template installs v4 but
I'm not sure which one is right and if CRA properly supports TypeScript 4 yet. |
edit: I was thinking of a different project; it looks like CRA 4 really doesn't support TS 4 at all |
New jsx is supported only in typescript 4.1, react-script 4.0.0 prerelease version was not throwing error, |
I am having a similar issue where the generated tsconfig from cra with ts@4.1 beta errors out when I start for the second time. I'm guessing it's because although it generates |
Also not working with 4.1.1-rc |
A solution was posted in another issue: #9892 (comment) |
You mean this solution? |
Delete tsconfig and start react, this will recreate tsconfig then it shows and restarting it creates the old issue again. i was looking into verifyTypeScriptSetup const { config: readTsConfig, error } = ts.readConfigFile( this readTsConfig is in turn assigned to appTsConfig. to make it mutable I edited it to, immer(appTsConfig, config => { now it is again showing, undefined fork-ts-checker-webpack-plugin is a requirement for react-dev-utils which is required by react-scripts, |
Also, I can see hasJsxRuntime && semver.gte(ts.version, '4.1.0-beta'), this is very specific, I updated it to match the version that is installed, the issue still persists |
I am having this issue with a fresh install of CRA
I deleted tsconfig.json and the first time it runs, I don't see the read only property error, but I see this:
If I kill the process and Not sure what to do now. |
+1
|
I am also experiencing these issues, really looking forward for CRA with typescript to support the new JSX transform. |
Can confirm that Output after
And there's no need to mention the "fix" |
I created a brand new create-react-app today, with the typescript template. It installs typescript@4.0.3, and doing an npm start is failing for me as well, I didn't try using a beta version of TS either |
I am also experiencing this when creating a new application. The workaround for me was to downgrade Typescript: - "typescript": "^4.0.3"
+ "typescript": "4.0.2" And change the tsconfig's jsx option: - "jsx": "react-jsx"
+ "jsx": "react" With those changes, the application is starting as expected 👌 |
I found out a work around as well. If you want to use 4.1: You cannot install 4.1.2, but you can install "typescript": "^4.1.0-beta".... Somehow 4.1.0-beta has the new transform, but 4.1.2 doesn't. And then, you must manually patch the verifyTypeScriptSetup file with the merged pr that isn't in a release yet: https://github.com/facebook/create-react-app/pull/9921/files, this is what I am doing for now. |
Running into this in TypeScript 4.1.2, seen it happen with rc and beta as well though |
I will add to @zackify comment, that when running react-scripts@next, you can also rename the typescript version in that file to typescript 4.1.2 and it works |
react-scripts 4.0.1 has been published, |
Yay! It works |
Yess, my project works now aswell. 🎊 |
@floyd-jones make sure to select the workspace typescript version in vscode(ctrl+shift+p and then type ”TypeScript: Select Version”, make sure it's 4.1.2 |
Issue resolved |
@RNR1 Thank you! |
Issue running "react-scripts": "4.0.0" with typescript 4.1 beta and 4.1.0-dev.20201029
appTsConfig.compilerOptions[option] = value;
^
TypeError: Cannot assign to read only property 'jsx' of object '#'
at verifyTypeScriptSetup (C:\Users~\proj\doc\node_modules\react-scripts\scripts\utils\verifyTypeScriptSetup.js:239:43)
at Object. (C:\Users~\proj\doc\node_modules\react-scripts\scripts\start.js:31:1)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47
System:
OS: Windows 10 10.0.19041
CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
Binaries:
Node: 15.0.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - C:\Program Files\nodejs\yarn.CMD
npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.423.0), Chromium (86.0.622.56)
Internet Explorer: 11.0.19041.1
npmPackages:
react: ^17.0.1 => 17.0.1
react-dom: ^17.0.1 => 17.0.1
react-scripts: 4.0.0 => 4.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
-After running yarn create react-app doc --template typescript,
-I updated typescript to beta and 4.1.0-dev.20201029, this producing the following error
Expected behavior
The app should run
Actual behavior
Error causing failure to run.
Reproducible demo
the source file can be found here
https://drive.google.com/file/d/16dZNYLMiZ7OuruyKkSfJ4g8nwsm7lqyQ/view?usp=sharing
The text was updated successfully, but these errors were encountered: