contentlayer: Unable to install contentlayer in NextJs v13.2.1

Hey all, 💖 contentlayer.

I’ve started a fresh Next project on the newest version 13.2.1 and I’m getting some unable to resolve dependency tree errors when trying to install. See below:

$ npm i contentlayer
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: @opentelemetry/api@1.1.0
npm ERR! node_modules/@opentelemetry/api
npm ERR!   @opentelemetry/api@"~1.1.0" from @contentlayer/utils@0.3.0
npm ERR!   node_modules/@contentlayer/utils
npm ERR!     @contentlayer/utils@"0.3.0" from contentlayer@0.3.0
npm ERR!     node_modules/contentlayer
npm ERR!       contentlayer@"*" from the root project
npm ERR!     @contentlayer/utils@"0.3.0" from @contentlayer/cli@0.3.0
npm ERR!     node_modules/@contentlayer/cli
npm ERR!       @contentlayer/cli@"0.3.0" from contentlayer@0.3.0
npm ERR!     node_modules/@effect-ts/otel-exporter-trace-otlp-grpc
npm ERR!       @effect-ts/otel-exporter-trace-otlp-grpc@"^0.14.0" from @contentlayer/utils@0.3.0
npm ERR!       node_modules/@contentlayer/utils
npm ERR!         @contentlayer/utils@"0.3.0" from contentlayer@0.3.0
npm ERR!         node_modules/contentlayer
npm ERR!         4 more (@contentlayer/cli, @contentlayer/core, ...)
npm ERR!     1 more (@effect-ts/otel-sdk-trace-node)
npm ERR!   15 more (@opentelemetry/core, @opentelemetry/sdk-trace-base, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @opentelemetry/api@"^1.4.0" from next@13.2.1
npm ERR! node_modules/next
npm ERR!   next@"13.2.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
$ npm i next-contentlayer
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: @opentelemetry/api@1.1.0
npm ERR! node_modules/@opentelemetry/api
npm ERR!   @opentelemetry/api@"~1.1.0" from @contentlayer/utils@0.3.0
npm ERR!   node_modules/@contentlayer/utils
npm ERR!     @contentlayer/utils@"0.3.0" from next-contentlayer@0.3.0
npm ERR!     node_modules/next-contentlayer
npm ERR!       next-contentlayer@"*" from the root project
npm ERR!     @contentlayer/utils@"0.3.0" from @contentlayer/core@0.3.0
npm ERR!     node_modules/@contentlayer/core
npm ERR!       @contentlayer/core@"0.3.0" from next-contentlayer@0.3.0
npm ERR!       node_modules/next-contentlayer
npm ERR!         next-contentlayer@"*" from the root project
npm ERR!   peer @opentelemetry/api@"^1.1.0" from @effect-ts/otel@0.14.1
npm ERR!   node_modules/@effect-ts/otel
npm ERR!     @effect-ts/otel@"^0.14.0" from @contentlayer/utils@0.3.0
npm ERR!     node_modules/@contentlayer/utils
npm ERR!       @contentlayer/utils@"0.3.0" from next-contentlayer@0.3.0
npm ERR!       node_modules/next-contentlayer
npm ERR!         next-contentlayer@"*" from the root project
npm ERR!       1 more (@contentlayer/core)
npm ERR!     @effect-ts/otel@"^0.14.1" from @effect-ts/otel-exporter-trace-otlp-grpc@0.14.1
npm ERR!     node_modules/@effect-ts/otel-exporter-trace-otlp-grpc
npm ERR!       @effect-ts/otel-exporter-trace-otlp-grpc@"^0.14.0" from @contentlayer/utils@0.3.0
npm ERR!       node_modules/@contentlayer/utils
npm ERR!         @contentlayer/utils@"0.3.0" from next-contentlayer@0.3.0
npm ERR!         node_modules/next-contentlayer
npm ERR!         1 more (@contentlayer/core)
npm ERR!     1 more (@effect-ts/otel-sdk-trace-node)
npm ERR!   15 more (@opentelemetry/core, @opentelemetry/sdk-trace-base, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @opentelemetry/api@"^1.4.0" from next@13.2.1
npm ERR! node_modules/next
npm ERR!   next@"13.2.1" from the root project
npm ERR!   peer next@"^12 || ^13" from next-contentlayer@0.3.0
npm ERR!   node_modules/next-contentlayer
npm ERR!     next-contentlayer@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Cheers

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 11
  • Comments: 19

Commits related to this issue

Most upvoted comments

Sorry for the inconvenience folks. I’m currently on vacation but will release a new version with a fix when I’m back later this month! 🏝️

Unless I’ve missed anything, given that the opentelemetry package versions are in conflict with the peer dependency versions of Next 13.2 (1.4.1), would it not be just a matter of upgrading the underlying packages? Thanks!

Ref: #360 (comment)

I’ve added "@opentelemetry/api": "^1.4.0" to my project’s package.json and npm install went through without issues. A temporary solution, but maybe better than using the --force flag.

Let’s just wait for the update to make it compatible with the latest Next version

Hey Schickling, unfortunately it seems not. 😦

~/work/dotu-web-mdx (main*) » npm install                                                                         1 ↵ cibulka@Petrs-MBP
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: next@13.2.4
npm ERR! Found: @opentelemetry/api@1.1.0
npm ERR! node_modules/@opentelemetry/api
npm ERR!   @opentelemetry/api@"~1.1.0" from @contentlayer/utils@0.3.1
npm ERR!   node_modules/@contentlayer/utils
npm ERR!     @contentlayer/utils@"0.3.1" from contentlayer@0.3.1
npm ERR!     node_modules/contentlayer
npm ERR!       contentlayer@"^0.3.1" from the root project
npm ERR!     @contentlayer/utils@"0.3.1" from next-contentlayer@0.3.1
npm ERR!     node_modules/next-contentlayer
npm ERR!       next-contentlayer@"^0.3.1" from the root project
npm ERR!     4 more (@contentlayer/cli, @contentlayer/core, ...)
npm ERR!   peer @opentelemetry/api@"^1.1.0" from @effect-ts/otel@0.14.1
npm ERR!   node_modules/@effect-ts/otel
npm ERR!     @effect-ts/otel@"^0.14.0" from @contentlayer/utils@0.3.1
npm ERR!     node_modules/@contentlayer/utils
npm ERR!       @contentlayer/utils@"0.3.1" from contentlayer@0.3.1
npm ERR!       node_modules/contentlayer
npm ERR!         contentlayer@"^0.3.1" from the root project
npm ERR!       5 more (next-contentlayer, @contentlayer/cli, ...)
npm ERR!     @effect-ts/otel@"^0.14.1" from @effect-ts/otel-exporter-trace-otlp-grpc@0.14.1
npm ERR!     node_modules/@effect-ts/otel-exporter-trace-otlp-grpc
npm ERR!       @effect-ts/otel-exporter-trace-otlp-grpc@"^0.14.0" from @contentlayer/utils@0.3.1
npm ERR!       node_modules/@contentlayer/utils
npm ERR!         @contentlayer/utils@"0.3.1" from contentlayer@0.3.1
npm ERR!         node_modules/contentlayer
npm ERR!         5 more (next-contentlayer, @contentlayer/cli, ...)
npm ERR!     1 more (@effect-ts/otel-sdk-trace-node)
npm ERR!   15 more (@opentelemetry/core, @opentelemetry/sdk-trace-base, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @opentelemetry/api@"^1.4.0" from next@13.2.4
npm ERR! node_modules/next
npm ERR!   next@"13.2.4" from the root project
npm ERR!   peer next@"^12 || ^13" from next-contentlayer@0.3.1
npm ERR!   node_modules/next-contentlayer
npm ERR!     next-contentlayer@"^0.3.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @opentelemetry/api@1.4.1
npm ERR! node_modules/@opentelemetry/api
npm ERR!   peerOptional @opentelemetry/api@"^1.4.0" from next@13.2.4
npm ERR!   node_modules/next
npm ERR!     next@"13.2.4" from the root project
npm ERR!     peer next@"^12 || ^13" from next-contentlayer@0.3.1
npm ERR!     node_modules/next-contentlayer
npm ERR!       next-contentlayer@"^0.3.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/cibulka/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/cibulka/.npm/_logs/2023-03-28T09_32_23_929Z-debug-0.log

Issue is the same both with 13.2.1 and 13.2.4 (the current version).

If I proceed with npm install --force, the project is full of those errors: Uncaught ChunkLoadError: Loading chunk app/[locale]/page failed.

Sorry for the delay. This should be addressed with the 0.3.1 release. 🎉

Also happens with 13.2.4

Apologies for the inconvenience. I’ll try to get in touch with the Next.js team and investigate this further to release a new patch in the coming weeks.

@cibulka Please keep in mind that this is a free open source project.

@Clarity-89 This works! Thank you! 😃

Unless I’ve missed anything, given that the opentelemetry package versions are in conflict with the peer dependency versions of Next 13.2 (1.4.1), would it not be just a matter of upgrading the underlying packages? Thanks!

Ref: https://github.com/contentlayerdev/contentlayer/issues/360#issuecomment-1486404489

I’ve ended up using using "next": "13.0.7" in my package.json. This downgrades next a bit to a version where there is no peer dependency conflict. This isn’t an ideal solution, but I’m not sure if a change needs to be made in the peer dependency specification of next, or contentlayer.