前提
プログラム歴1年未満
実現したいこと
React18+TS+Flask+MySQL環境にてユーザーからの入力値をリアルタイムで受け取り、受け取ったデータがあれば画面に表示するアプリを構築している際にWindowsがクラッシュしてしまいました。
以後 npm startを行うも以下のメッセージが表示されローカルサーバーが立ち上がらず困っています。
どのようにすれば正常に起動することができるでしょうか。
初歩的な質問になると思われますがご教示願います
- ▲
発生している問題・エラーメッセージ
frontend\node_modules\react-scripts\scripts\start.js:19 throw err; SyntaxError: Unexpected token in JSON at position 0 at JSON.parse (<anonymous>) at Object.getBuildInfo (frontend\node_modules\typescript\lib\typescript.js:110534:21) at readBuilderProgram (frontend\node_modules\typescript\lib\typescript.js:123290:28) at Object.createWatchProgram (frontend\node_modules\typescript\lib\typescript.js:123446:26) at Object.<anonymous> (frontend\node_modules\fork-ts-checker-webpack-plugin\lib\typescript-reporter\reporter\TypeScriptReporter.js:304:59) at Generator.next (<anonymous>) at frontend\node_modules\fork-ts-checker-webpack-plugin\lib\typescript-reporter\reporter\TypeScriptReporter.js:8:71 at new Promise (<anonymous>) at __awaiter (frontend\node_modules\fork-ts-checker-webpack-plugin\lib\typescript-reporter\reporter\TypeScriptReporter.js:4:12) at Object.getIssues (frontend\node_modules\fork-ts-checker-webpack-plugin\lib\typescript-reporter\reporter\TypeScriptReporter.js:227:28)
該当のソースコード
*試した事(2)の追加コード&出力内容(frontend\node_modules\react-scripts\scripts\start.js:19) process.on('unhandledRejection', err => { tyr { throw err; } //tyr節の追加 catch(e) { console.log(e) } }); →コンソール( Compiled successfully! You can now view frontend in the browser. Local: http://localhost:3000 On Your Network: http://{略}:3000 Note that the development build is not optimized. To create a production build, use npm run build. webpack compiled successfully (node:8112) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1) SyntaxError: Unexpected token in JSON at position 0 ...以下. 上記記載の[発生している問題・エラーメッセージ]同様文章
試したこと
1.create react app を別に構築しnpm start を行った.
→問題なく起動する
2.try節を追加することでサーバーは起動する。
が常に[発生している問題・エラーメッセージ]記載内容がコンソールに表示されている。
またhttps://qiita.com/103ma2/items/9cfab6604f813720d482
好ましくない状態だとも書いてもいる
3.npm doctorで検証?
npm ping ok
npm -v ok current: v8.15.1, latest: v8.15.1
node -v ok current: v16.16.0, recommended: v16.16.0
npm config get registry ok using default registry (https://registry.npmjs.org/)
which git not ok Install git and ensure it's in your PATH.
Verify cache contents ok verified 6100 tarballs
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー