Tutorial on Next.js site (How to Load Data from a File in Next.js) doesn't work...
Unanswered
Brown bear posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Brown bearOP
So I'm trying to follow the tutorial on the NextJS site: https://vercel.com/guides/loading-static-file-nextjs-api-route
Basically, it doesn't seem to match up correctly to the files created when I run
Basically, it doesn't seem to match up correctly to the files created when I run
create-next-app
- I don't even have the pages
folder mentioned! How do I need to adapt this tutorial to make it work with the current version of Next.js? Thanks in advance!4 Replies
![Avatar](https://cdn.discordapp.com/avatars/602953499407286331/b2ddc5d07aefa902d90e1613e7f970dd.webp?size=256)
ncls.
Next.js basically has two versions. In one you have the
Check if you have the
pages
folder, in the other you have the app
folder. create-next-app
will ask you which one you'd like to use ("Would you like to use App Router?").Check if you have the
app
folder.![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Brown bearOP
oh wow, now I feel stupid
thank you!
![:lolsob:](https://cdn.discordapp.com/emojis/753870958489632819.png)
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Brown bearOP
So I had another crack at this with a new project based off the pages router... and I still don't seem to be able to get this working! Everything is in place, but I get the following error:
I've gone as far as to clone the tutorial repo, which worked fine... but then when I copied the edited files into my own project (after installing swr) I still get the same error message! Is there anything else I might be missing? It seems like it can't find the json file maybe, but it's definitely there!
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'name')
I've gone as far as to clone the tutorial repo, which worked fine... but then when I copied the edited files into my own project (after installing swr) I still get the same error message! Is there anything else I might be missing? It seems like it can't find the json file maybe, but it's definitely there!
![Avatar](https://cdn.discordapp.com/avatars/602953499407286331/b2ddc5d07aefa902d90e1613e7f970dd.webp?size=256)
ncls.
Share some code