Search code examples
node.jsangularversionpeer-dependenciesversionupgrade

Which angular version should be used for node version 20.15.1


I upgraded node version 14 to version 20.15.1 and upgraded angular-cli to version 17.3.8 but I am facing peer depedencies version mismatch error.How can I handle it. I did npm i and updated all package version in package.json and deleted package-lock.json. enter image description here


Solution

  • Clear npm cache: Run the following command to clear the npm cache:

    npm cache clean --force
    

    Remove node_modules directory: Delete the node_modules directory to ensure a clean slate

    rm -rf node_modules
    

    Reinstall dependencies: Reinstall all dependencies by running:

    npm install
    

    Use npm ls to identify peer dependency issues: Run the following command to list all installed packages and identify any peer dependency issues:

    npm ls
    

    Resolve peer dependency issues:

    Manually: Review the output of npm ls and manually update the dependencies in your package.json file to match the required versions. Using

    npm install --force or --legacy-peer-deps
    

    Use npx npm-check-updates: Install npm-check-updates globally if you haven't already:

     npm install -g npm-check-updates
    

    run the following command to update your package.json

    npx npm-check-updates -u
    npm install
    

    Check Angular CLI specific dependencies:

    ng update