前提
「TypeScriptとReact/Next.jsでつくる 実践Webアプリケーション開発」という書籍のサンプルプログラムなのですが、クローン後サーバーを起動しようとすると「connect ECONNREFUSED 127.0.0.1:8000」というエラーが出てしまいます。
https://github.com/gihyo-book/ts-nextbook-app
実現したいこと
書籍の学習前に一旦完成品を確認したいと思っています。
発生している問題・エラーメッセージ
Server Error FetchError: request to http://localhost:8000/products?category=clothes&_page=1&_limit=6&_sort=id&_order=desc failed, reason: connect ECONNREFUSED 127.0.0.1:8000 This error happened while generating the page. Any console logs will be displayed in the terminal window. Call Stack <unknown> fetcherror: request to http://localhost:8000/products (8000) <unknown> (FetchError: request to http://localhost:8000/products (8000) ClientRequest.<anonymous> file:///C:/Users/cs19023/Documents/study/react/ts-nextbook-app/node_modules/next/dist/compiled/node-fetch/index.js (1:65763) ClientRequest.emit node:events (513:28) Socket.socketErrorListener node:_http_client (494:9) Socket.emit node:events (513:28) emitErrorNT node:internal/streams/destroy (157:8) emitErrorCloseNT node:internal/streams/destroy (122:3) processTicksAndRejections node:internal/process/task_queues (83:21)
試したこと
クローン後「npm install」でパッケージをインストールし、ソースコードの変更はせず、「npm run dev」としただけです。
おそらくローカルで立ち上げるapiサーバ―とのやり取りが上手くいっていない状態だと思うのですが、原因が分かりませんでした。
書籍のプログラムなので他に症例があるか探しましたけど見当たらなかったので、自分の環境の問題なのかも知りたいです。
補足情報(FW/ツールのバージョンなど)
next 12.2.3
react 18.2.0
typescript 4.6.2

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/12/22 05:51
2022/12/22 07:40 編集