timlrx / tailwind-nextjs-starter-blog

This is a Next.js, Tailwind CSS blogging starter template. Comes out of the box configured with the latest technologies to make technical writing a breeze. Easily configurable and customizable. Perfect as a replacement to existing Jekyll and Hugo individual blogs.
https://tailwind-nextjs-starter-blog.vercel.app/
MIT License
8.56k stars 1.99k forks source link

Error While using yarn build #726

Closed prateekjpr20 closed 11 months ago

prateekjpr20 commented 11 months ago

Describe the bug This bug is coming when I am using yarn build or npm run build.

Even if i deleted this file, this file gets created automatically. Attaching my files for better reference.

SuccessCallbackError { error: TypeError: Unknown file extension ".json" for /Users/Sonia/Documents/asi/.contentlayer/generated/Blog/_index.json at new NodeError (node:internal/errors:371:5) at Object.file: (node:internal/modules/esm/get_format:72:15) at defaultGetFormat (node:internal/modules/esm/get_format:85:38) at defaultLoad (node:internal/modules/esm/load:13:42) at ESMLoader.load (node:internal/modules/esm/loader:303:26) at ESMLoader.moduleProvider (node:internal/modules/esm/loader:230:58) at new ModuleJob (node:internal/modules/esm/module_job:63:26) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:244:11) at ModuleWrap. (node:internal/modules/esm/module_job:78:21) at async Promise.all (index 1) { code: 'ERR_UNKNOWN_FILE_EXTENSION' }, _tag: 'SuccessCallbackError', toString: [Function (anonymous)],

error: TypeError: Unknown file extension ".json" for /Users/Sonia/Documents/asi/.contentlayer/generated/Blog/_index.json
    at new NodeError (node:internal/errors:371:5)
    at Object.file: (node:internal/modules/esm/get_format:72:15)
    at defaultGetFormat (node:internal/modules/esm/get_format:85:38)
    at defaultLoad (node:internal/modules/esm/load:13:42)
    at ESMLoader.load (node:internal/modules/esm/loader:303:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:230:58)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:244:11)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:78:21)
    at async Promise.all (index 1) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

}, Archive.zip

Symbol(): [ 'error' ] }

timlrx commented 11 months ago

Contentlayer will generate the parsed content files automatically, you should not delete it!

The Unknown file extension ".json" error suggests that it is not reading it properly. Are you using a freshly cloned repository? And what's your node version? Try using a recent version of node 18+ if you are not already doing so.

prateekjpr20 commented 11 months ago

I updated node and it solved the issue. thanks for such a fast support.