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

Could not resolve dependency: npm ERR! peer next@"^12 || ^13" from [email protected] npm ERR! node_modules/next-contentlayer npm ERR! next-contentlayer@"^0.3.4" from the root project #607

Closed
alamenai opened this issue Nov 28, 2023 · 6 comments

Comments

@alamenai
Copy link

alamenai commented Nov 28, 2023

Hi Contenlayer Team,

Thank you so much for this amazing solution. We really enjoy working with it.

Today, our build failed in the deployment environment and I found that the issue behind this is the version compatibility between NextJS 14 and the ContentLayer version.

In my local, I installed the dependency using legacy-peer-deps, and everything worked well, however, when I pushed the code and during the build time, I got this issue:

image

This my azure-pipeline.yml

# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
- task: NodeTool@0
  inputs:
    versionSource: 'spec'
    versionSpec: '10.x'
    checkLatest: true
  displayName: 'Install Node.js'

- script: |
    npm install
    npm run build
  displayName: 'npm install and build'
@ghost
Copy link

ghost commented Nov 28, 2023

Try to install using npm install --force

@Chrismacolor
Copy link

Getting same error with NextJS 14. npm install --force every time is not a stable option. Any plans on fixing this?

@ghost
Copy link

ghost commented Dec 1, 2023

Switch next.js to a supported version or fork this repository and update the package.

@alamenai
Copy link
Author

alamenai commented Dec 1, 2023

I temporarily used npm install --lagacy-peer-deps but I faced issues with the CI/CD because you have to apply this also during the deployment process.

You have to force your installation with --leagcy-peer-deps by configuring your .npmrc:

legacy-peer-deps=true

@rosszurowski
Copy link

This is the same error that's captured in #575. Generally, the recommended way to solve it is with npm, yarn, or pnpm overrides, like is described in this comment.

@Sabir222
Copy link

@MenaiAla you are a life saver thanks the .npmrc solution worked i hope they update the next-contentlayer soon.

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

4 participants