3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Uncaught TypeError: fetch failedというエラーの対処

Last updated at Posted at 2024-09-24

はじめに

最近Next.jsの学習し始めてなぜかjson-serverからのデータ取得ができなかったので載せます。

問題

以前まで正常にデータ取得できていたのに、別日にサーバを立ち上げると以下のエラーが出る。

Uncaught TypeError: fetch failed

原因

json-serverも立ち上げる必要がありました。検索するとサーバがちゃんと立ち上がってるかなどガッツリ出てきますがnpm run devしているからてっきり大丈夫だと思いjson-serverの存在を忘れていました(apiのコードと睨めっこしていた...)。

json-server --watch パス名 --port ポート番号

おわりに

初心者丸出しのエラーでした。

3
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?