Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI is broken #505

Closed
zbeyens opened this issue Jul 6, 2023 · 10 comments
Closed

CLI is broken #505

zbeyens opened this issue Jul 6, 2023 · 10 comments

Comments

@zbeyens
Copy link

zbeyens commented Jul 6, 2023

After resetting my yarn.lock, running yarn contentlayer <command> outputs:

file:///Users/zbeyens/GitHub/plate/node_modules/@effect-ts/otel/_mjs/Processor/Simple/index.mjs:7
import { ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
         ^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'ConsoleSpanExporter' not found. The requested module '@opentelemetry/sdk-trace-base' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@opentelemetry/sdk-trace-base';
const { ConsoleSpanExporter, SimpleSpanProcessor } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)
    at async main (/Users/zbeyens/GitHub/plate/node_modules/contentlayer/bin/cli.cjs:4:19)

It still works if I don't reset my yarn.lock.

Using:

  • node: v16.19.1
  • yarn berry
  • "next": "13.4.8",
  • "next-contentlayer": "0.3.4",
  • "contentlayer": "0.3.4",
@jahirfiquitiva
Copy link
Contributor

I'm having the very same issue, and it breaks the build on Vercel 😭

@ThimoDEV
Copy link

ThimoDEV commented Jul 6, 2023

Same issue here

next 13.4.8
pnpm shamefully-hoist
contentlayer 0.3.4 and 0.3.3 do not work
node v18.16

@abdul-hamid-achik
Copy link

same here, i have the same next 13.4.9, content layer and next-contentlayer 0.3.4, node v20.0.0

@emkis
Copy link

emkis commented Jul 6, 2023

I have the same problem, but it only happens when the Next config file uses ESM (import/export). I managed to make it work by temporarily changing the config file to next.config.cjs, and everything works well.

Environment

  • next: 13.4.9
  • node: 18.16.0
  • pnpm: 8.6.2
  • contentlayer: 0.3.4
  • next-contentlayer: 0.3.4

@abdul-hamid-achik
Copy link

I have the same problem, but it only happens when the Next config file uses ESM (import/export). I managed to make it work by temporarily changing the config file to next.config.cjs, and everything works well.

Environment

  • next: 13.4.9
  • node: 18.16.0
  • pnpm: 8.6.2
  • contentlayer: 0.3.4
  • next-contentlayer: 0.3.4

oh wow, what a great tmpfix dude!

@XahidEx
Copy link
Contributor

XahidEx commented Jul 7, 2023

Also having the same issue

@XahidEx
Copy link
Contributor

XahidEx commented Jul 7, 2023

I'm having the very same issue, and it breaks the build on Vercel sob

Changing region from function helped me. :) I know It sounds crazy

@wibb36
Copy link
Contributor

wibb36 commented Jul 7, 2023

This issue appears to be duplicated in issue #506, where a temporary solution has been provided; #506 (comment)

@zbeyens
Copy link
Author

zbeyens commented Jul 7, 2023

Closing this one in favor of #506 then.

@zbeyens zbeyens closed this as completed Jul 7, 2023
rjmccluskey added a commit to rjmccluskey/richmccluskey.dev that referenced this issue Jul 12, 2023
This was necessary to get contentlayer working.
See contentlayerdev/contentlayer#505 (comment)
@stepcellwolf
Copy link

I have the same problem, but it only happens when the Next config file uses ESM (import/export). I managed to make it work by temporarily changing the config file to next.config.cjs, and everything works well.
Environment

  • next: 13.4.9
  • node: 18.16.0
  • pnpm: 8.6.2
  • contentlayer: 0.3.4
  • next-contentlayer: 0.3.4

oh wow, what a great tmpfix dude!

For me, it does not work to build the GitHUb Action workflow. On the localhost, it is working. Any other suggestions?

`
Run npm run build

pt-nextjs-blog @1.0.0 build
cross-env INIT_CWD=$PWD next build

  • info Loaded env from /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/.env

  • warn No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
    Attention: Next.js now collects completely anonymous telemetry regarding usage.
    This information is used to shape Next.js' roadmap and prioritize features.
    You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
    https://nextjs.org/telemetry

  • info Creating an optimized production build...
    Failed to compile.

./app/about/page.tsx
Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/[...slug]/page.tsx
Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/page.tsx
Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/page/[page]/page.tsx
Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/page.tsx
Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

Build failed because of webpack errors
Error: Process completed with exit code 1.
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants