contentlayerdev / contentlayer

Contentlayer turns your content into data - making it super easy to import MD(X) and CMS content in your app
https://www.contentlayer.dev
MIT License
3.19k stars 200 forks source link

Unchecked error on contentlayer build #641

Open aarongsellin opened 4 months ago

aarongsellin commented 4 months ago

Hello guys, I was following this YouTube tutorial on how to make a nice markdown viewer. I followed his steps to the dot, except for the fact that my project is in a turbo repo, and my docs are in the root of the turborepo, not of the next.js project.

I also ran into some issues of the compilerOptions baseUrl and contentlayer/generated, not being configured in the tsconfig.json file. After fixing that I started running into the following issue.

After that I ran yarn build in the cntl-ui project, not in the root of the turbo repo and It fixed that issue. Then I ran yarn contentlayer build as instructed, and I got the error you see below.

I'm creating this issue because one, I need help I really wan't this to work. Second It told me to consider opening an issue so I thought It might be important to other people stumbling across this in the future as well.


yarn run v1.22.19
$ C:\Users\46705\Documents\GitHub\panel\node_modules\.bin\contentlayer build
Warning: Contentlayer might not work as expected on Windows
This error shouldn't have happened. Please consider opening a GitHub issue with the stack trace below here:
https://github.com/contentlayerdev/contentlayer/issues

╥
╠══╦══╗
║  ║  ║
║  ║  ╠─An interrupt was produced by #6.
║  ║  ║
║  ║  ▼
║  ║
║  ╠─An unchecked error was produced.
║  ║
║  ║ Error: A case was not handled for value: "string"
║  ║     at Module.casesHandled (file:///C:/Users/46705/Documents/GitHub/panel/node_modules/@contentlayer/utils/src/index.ts:85:9)
║  ║     at fieldDefEntryToCoreFieldDef (file:///C:/Users/46705/Documents/GitHub/panel/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:240:13)
║  ║     at file:///C:/Users/46705/Documents/GitHub/panel/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:26:9
║  ║     at Array.map (<anonymous>)
║  ║     at next (file:///C:/Users/46705/Documents/GitHub/panel/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:25:70)
║  ║     at Generator.next (<anonymous>)
║  ║     at ISuspend.factory (file:///C:/Users/46705/Documents/GitHub/panel/node_modules/@effect-ts/system/_src/Effect/gen.ts:135:28)
║  ║     at FiberContext.evaluateNow (file:///C:/Users/46705/Documents/GitHub/panel/node_modules/@effect-ts/system/_src/Fiber/context.ts:1173:51)
║  ║     at file:///C:/Users/46705/Documents/GitHub/panel/node_modules/@effect-ts/system/_src/Fiber/context.ts:576:33
║  ║     at file:///C:/Users/46705/Documents/GitHub/panel/node_modules/@effect-ts/system/_src/Support/Scheduler/index.ts:15:9
║  ║
║  ║ Fiber: #21 (started at: 2024-02-15T11:34:16.808Z) was supposed to continue to: <empty trace>
║  ║
║  ║ Fiber: #21 (started at: 2024-02-15T11:34:16.808Z) Execution trace: <empty trace>
║  ║
║  ║ Fiber: #21 (started at: 2024-02-15T11:34:16.808Z) was spawned by:
║  ║
║  ║ Fiber: #6 (started at: 2024-02-15T11:34:16.563Z) was supposed to continue to: <empty trace>
║  ║
║  ║ Fiber: #6 (started at: 2024-02-15T11:34:16.563Z) Execution trace: <empty trace>
║  ║
║  ║ Fiber: #6 (started at: 2024-02-15T11:34:16.563Z) was spawned by: <empty trace>
║  ▼
▼

OS: win32 10.0.22631 (arch: x64)
Process: C:\Program Files\nodejs\node.exe C:\Users\46705\Documents\GitHub\panel\node_modules\contentlayer\bin\cli.cjs build
Node version: v18.17.0
Contentlayer version: 0.3.4

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```
auziqni commented 4 months ago

same here, i run contentlayer on npm script "contentlayer": "contentlayer build" , same error

igormcsouza commented 3 months ago

I had the same issue.. I just copied the file from here.. https://raw.githubusercontent.com/shadcn-ui/taxonomy/main/contentlayer.config.js and changed what I wanted and it worked.. For me this configurations is still gibberish, so I can't help much.. but at least can give a file that is working! :D

marcusleonas commented 1 month ago

Any updates on this? I'm getting the same error