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
- fix opentelemetry version incompatibility with next 13.2 fix #386 — committed to jgillich/contentlayer by jgillich a year ago
- 🐛 Fix npm install failing due to Contentlayer - Workaround for https://github.com/contentlayerdev/contentlayer/issues/386 - Next.js v13.2 and Contentlayer have an incompatibility because they depend... — committed to n1ckoates/blog by n1ckoates a year ago
- 🐛 Fix npm install failing due to Contentlayer - Workaround for https://github.com/contentlayerdev/contentlayer/issues/386 - Next.js v13.2 and Contentlayer have an incompatibility because they depend... — committed to n1ckoates/blog by n1ckoates a year ago
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! 🏝️
I’ve added
"@opentelemetry/api": "^1.4.0"to my project’spackage.jsonandnpm installwent through without issues. A temporary solution, but maybe better than using the--forceflag.Let’s just wait for the update to make it compatible with the latest Next version
Hey Schickling, unfortunately it seems not. 😦
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.1release. 🎉Also happens with
13.2.4Apologies 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.