Skip to content

npx contentlayer2 build gives ENOENT error #41

@ham-evans

Description

@ham-evans

As mentioned, running
npx contentlayer2 build
is giving the following error:

Error: ENOENT: no such file or directory, read
    at async readFileHandle (node:internal/fs/promises:553:24)
    at async getSource (node:internal/modules/esm/load:46:14)
    at async defaultLoad (node:internal/modules/esm/load:137:34)
    at async ModuleLoader.load (node:internal/modules/esm/loader:553:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:45) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'read'
}

Just started happening. Running contentlayer2 0.5.1, Next.js 14.2.12 and Node 20.17.0. This is breaking next dev and next build. Do have type:module in package.json which throws webhook error as mentioned in #20 but shouldn't cause any breaking problems so think this is something else. Would love a solution ASAP. Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions