LoginSignup
1
0

More than 3 years have passed since last update.

create-react-app typescriptテンプレート指定時エラーの対処法

Last updated at Posted at 2020-11-21

最新のcreate-react-appでtypescriptを指定した場合、下記エラーが発生するため私がとった対応策です

npx create-react-app <プロジェクト名> --template typescript
でプロジェクト作成後 npm start すると下記エラー↓

TypeError: Cannot assign to read only property 'jsx' of object ''
*エラー文以下省略

対応策
①srcフォルダ内にあるpackage.jsonのreact-scriptsとtypescriptのバージョンを下記内容に書き換える。
"react-scripts": "4.0.0-next.98",
"typescript": "^4.1.0",

②node_modules & package-lock.jsonを削除

③npm install

④npm start

私はこれで対処できました!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0