未在nextjs 14.1.0版本中安装next-contentlayer

问题描述 投票:0回答:1

当我尝试在 nextjs 14.1.0 中安装 next-contentlayer 时。它显示错误。我无法安装 next-contentlayer。 谁能建议我如何安装它?

 `npm install next-contentlayer
  npm ERR! code ERESOLVE
  npm ERR! ERESOLVE unable to resolve dependency tree
  npm ERR! 
  npm ERR! While resolving: [email protected]
  npm ERR! Found: [email protected]
  npm ERR! node_modules/next
  npm ERR!   next@"14.1.0" from the root project
  npm ERR! 
  npm ERR! Could not resolve dependency:
  npm ERR! peer next@"^12 || ^13" from [email protected]
  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.
next.js blogs contentlayer
1个回答
0
投票

基本上,下一个内容层存在依赖冲突,因为它需要下一个 12 或 13,并且维护者尚未更新下一个 14

你可以尝试2件事

  1. 将nextjs降级到13个版本中的任意一个(推荐)
npm install [email protected]
npm install next-contentlayer
  1. 使用 --legacy-peer-deps 或 --force 标志运行。
npm install next-contentlayer --force 
© www.soinside.com 2019 - 2024. All rights reserved.