"Error: Cannot find module 'react'"?? #260

Closed
opened 2026-10-05 02:36:14 +02:00 by adam · 6 comments
Owner

Sorry if I missed something obvious but...
Aren't all installs supposed to be automagical?
I'm getting a "Error: Cannot find module 'react'" after starting the server.
Do I need to npm install anything??
Thanks

Sorry if I missed something obvious but... Aren't all installs supposed to be automagical? I'm getting a "Error: Cannot find module 'react'" after starting the server. Do I need to npm install anything?? Thanks <!-- github-sync-id:1223308870 -->
adam closed this issue 2026-10-05 02:36:14 +02:00
Author
Owner

I do get a warning from "npx next info" though

  Operating System:
     Platform: win32
     Arch: x64
     Version: Windows 10 Pro
   Binaries:
     Node: 17.3.0
     npm: N/A
     Yarn: N/A
     pnpm: N/A
   Relevant packages:
     next: 12.1.5
     react: 18.1.0
     react-dom: 18.1.0

warn  - Latest canary version not detected, detected: "12.1.5", newest: "12.1.6-canary.17".
       Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
       Read more - https://nextjs.org/docs/messages/opening-an-issue
I do get a warning from "npx next info" though ``` Operating System: Platform: win32 Arch: x64 Version: Windows 10 Pro Binaries: Node: 17.3.0 npm: N/A Yarn: N/A pnpm: N/A Relevant packages: next: 12.1.5 react: 18.1.0 react-dom: 18.1.0 warn - Latest canary version not detected, detected: "12.1.5", newest: "12.1.6-canary.17". Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue. Read more - https://nextjs.org/docs/messages/opening-an-issue ``` <!-- github-comment-id:1115317748 -->
Author
Owner

What do you mean with aren't all installs supposed to be automagical?

In case you want to use Front Matter with your site, you will have to run all installs manually. Front Matter will do the content management part.

What do you mean with aren't all installs supposed to be automagical? In case you want to use Front Matter with your site, you will have to run all installs manually. Front Matter will do the content management part. <!-- github-comment-id:1115337243 -->
Author
Owner

Sorry for being so clueless but I very confused about the interaction between frontmatter and the chosen framework.
I have little to no experience with the Next framework (that the one I choose) but though it would manage all the needed libraries installs automatically.
I just looked at Next tutorial and it seams to manage all library dependencies, although it asked if I wanted to proceed installing "create-next-app".
So, I just ran npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter, cd to newly created folder and then npm run dev and that was it, I could now access the "Welcome Page" on http://localhost:3000/

Must I install react on the FM root folder?? And then keep installing all other missing libraries?
I'm really lost here :-\

Sorry for being so clueless but I very confused about the interaction between frontmatter and the chosen framework. I have little to no experience with the Next framework (that the one I choose) but though it would manage all the needed libraries installs automatically. I just looked at Next tutorial and it seams to manage all library dependencies, although it asked if I wanted to proceed installing "create-next-app". So, I just ran `npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter`, cd to newly created folder and then `npm run dev` and that was it, I could now access the "Welcome Page" on http://localhost:3000/ Must I install react on the FM root folder?? And then keep installing all other missing libraries? I'm really lost here :-\ <!-- github-comment-id:1116235972 -->
Author
Owner

Front Matter has nothing to do with the SSG or framework you use. It is only used to manage your content. That said, you must first create your project. In your case with Next.js, install its dependencies, open the root folder of the project in VS Code and start configuring it to use Front Matter.

It is very similar to the Hugo configuration which you can find here: https://frontmatter.codes/docs/ssg-and-frameworks/hugo-configuration#setting-up-front-matter-for-your-hugo-site

Front Matter has nothing to do with the SSG or framework you use. It is only used to manage your content. That said, you must first create your project. In your case with Next.js, install its dependencies, open the root folder of the project in VS Code and start configuring it to use Front Matter. It is very similar to the Hugo configuration which you can find here: https://frontmatter.codes/docs/ssg-and-frameworks/hugo-configuration#setting-up-front-matter-for-your-hugo-site <!-- github-comment-id:1116371303 -->
Author
Owner

I'm not used to these frameworks so I at least figured out I better start by learning them.
Maybe make that more explicit in the readme and you may avoid ignorant posts like this! ;-)
Thanks

I'm not used to these frameworks so I at least figured out I better start by learning them. Maybe make that more explicit in the readme and you may avoid ignorant posts like this! ;-) Thanks <!-- github-comment-id:1116528647 -->
Author
Owner

Closing as this was a question.

Thanks, @ruifortes for the suggestion on enhancing the documentation.

Closing as this was a question. Thanks, @ruifortes for the suggestion on enhancing the documentation. <!-- github-comment-id:1137112902 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#260