codebucks27 / Nextjs-tailwindcss-blog-template

⭐Build SEO optimized personal blog website with Next.js, Tailwind CSS and Contentlayer. If you want to learn to create this you can follow the tutorial link given in the Read me file.
https://create-blog-with-nextjs.vercel.app/
MIT License
463 stars 174 forks source link

any trick to getting it to work #9

Closed ktwbc closed 1 month ago

ktwbc commented 1 month ago

Clean install pnpm import to transfer the npm lock to pnpm.lock run dev

output:

> next dev

  ▲ Next.js 13.5.4
  - Local:        http://localhost:3000

 ✓ Ready in 3.5s
ConfigReadError (/Volumes/dev/Nextjs-tailwindcss-blog-template/contentlayer.config.js): Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@contentlayer/source-files' imported from /Volumes/dev/Nextjs-tailwindcss-blog-template/.contentlayer/.cache/v0.3.4/compiled-contentlayer-config-AJW2Z2G4.mjs
ConfigReadError (/Volumes/dev/Nextjs-tailwindcss-blog-template/contentlayer.config.js): Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@contentlayer/source-files' imported from /Volumes/dev/Nextjs-tailwindcss-blog-template/.contentlayer/.cache/v0.3.4/compiled-contentlayer-config-AJW2Z2G4.mjs
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
 ○ Compiling /page ...
 ⨯ ./src/app/page.js:1:0
Module not found: Package path ./generated is not exported from package /Volumes/dev/Nextjs-tailwindcss-blog-template/node_modules/contentlayer (see exports field in /Volumes/dev/Nextjs-tailwindcss-blog-template/node_modules/contentlayer/package.json)
> 1 | import {allBlogs} from "contentlayer/generated";
  2 | import HomeCoverSection from "../components/Home/HomeCoverSection";
  3 | import FeaturedPosts from "../components/Home/FeaturedPosts";
  4 | import RecentPosts from "../components/Home/RecentPosts";

https://nextjs.org/docs/messages/module-not-found
 ⨯ ./src/app/page.js:1:0
Module not found: Package path ./generated is not exported from package /Volumes/dev/Nextjs-tailwindcss-blog-template/node_modules/contentlayer (see exports field in /Volumes/dev/Nextjs-tailwindcss-blog-template/node_modules/contentlayer/package.json)
> 1 | import {allBlogs} from "contentlayer/generated";
  2 | import HomeCoverSection from "../components/Home/HomeCoverSection";
  3 | import FeaturedPosts from "../components/Home/FeaturedPosts";
  4 | import RecentPosts from "../components/Home/RecentPosts";

https://nextjs.org/docs/messages/module-not-found
 ⨯ ./src/app/page.js:1:0
Module not found: Package path ./generated is not exported from package /Volumes/dev/Nextjs-tailwindcss-blog-template/node_modules/contentlayer (see exports field in /Volumes/dev/Nextjs-tailwindcss-blog-template/node_modules/contentlayer/package.json)
> 1 | import {allBlogs} from "contentlayer/generated";
  2 | import HomeCoverSection from "../components/Home/HomeCoverSection";
  3 | import FeaturedPosts from "../components/Home/FeaturedPosts";
  4 | import RecentPosts from "../components/Home/RecentPosts";

https://nextjs.org/docs/messages/module-not-found
codebucks27 commented 1 month ago

@ktwbc It's working fine from my side. Here are the steps that I have followed:

npm install
npm run dev

When you run it for the first time it will display an error like ./generated is not exported from package but when you reload the page it should generate the blogs and then you should be able to see all the pages. Right now the contentlayer package is not maintained regularly so you can try Velite instead.