angular/angular-update-guide

Incompatible peer dependencies at every step

mwaibel-go opened this issue · 2 comments

I’ve used the migration guide on two projects now, upgrading step-by-step across a few major versions. On every step I get npm errors due to incompatible peer dependencies between the @angular packages when I run the migration.

After the error I force-install the dependencies via npm i --force, which brings the project to a functioning state. However, I believe this shouldn’t be necessary.

Note that in the log output I’ve replaced the actual project location with __PROJECT__ and the project name with __PROJECT_NAME__.

From v11 to v12

In this example I executed npx @angular/cli@12 update @angular/core@12 @angular/cli@12 on npm@v6.

/home/mwaibel/.npm/_logs_/${date}-debug.log.

0 verbose cli [
0 verbose cli   '/home/mwaibel/bin/node-v16.13.0-linux-x64/bin/node',
0 verbose cli   '/home/mwaibel/bin/node-v16.13.0-linux-x64/bin/npm',
0 verbose cli   'install',
0 verbose cli   '--quiet'
0 verbose cli ]
1 info using npm@8.1.0
2 info using node@v16.13.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:__PROJECT__/.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/home/mwaibel/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/home/mwaibel/bin/node-v16.13.0-linux-x64/etc/npmrc Completed in 1ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 8ms
19 timing npm:load:configload Completed in 8ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 0ms
22 timing config:load:flatten Completed in 2ms
23 timing npm:load:cleanupLog Completed in 1ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 0ms
26 timing npm:load Completed in 11ms
27 timing arborist:ctor Completed in 0ms
28 timing idealTree:init Completed in 689ms
29 timing idealTree:userRequests Completed in 1ms
30 silly idealTree buildDeps
31 silly fetch manifest @angular/animations@~12.2.14
32 http fetch GET 200 https://registry.npmjs.org/@angular%2fanimations 294ms (cache updated)
33 silly fetch manifest @angular/core@~12.2.14
34 http fetch GET 200 https://registry.npmjs.org/@angular%2fcore 133ms (cache updated)
35 silly fetch manifest rxjs@~6.6.0
36 http fetch GET 200 https://registry.npmjs.org/rxjs 7ms (cache hit)
37 silly fetch manifest zone.js@~0.11.4
38 http fetch GET 200 https://registry.npmjs.org/zone.js 52ms (cache revalidated)
39 silly fetch manifest @angular/common@~12.2.14
40 http fetch GET 200 https://registry.npmjs.org/@angular%2fcommon 132ms (cache updated)
41 silly fetch manifest @angular/compiler@~12.2.14
42 http fetch GET 200 https://registry.npmjs.org/@angular%2fcompiler 138ms (cache updated)
43 silly fetch manifest @angular/forms@~12.2.14
44 http fetch GET 200 https://registry.npmjs.org/@angular%2fforms 145ms (cache updated)
45 silly fetch manifest @angular/platform-browser@~12.2.14
46 http fetch GET 200 https://registry.npmjs.org/@angular%2fplatform-browser 148ms (cache updated)
47 silly fetch manifest @angular/platform-browser-dynamic@~12.2.14
48 http fetch GET 200 https://registry.npmjs.org/@angular%2fplatform-browser-dynamic 149ms (cache updated)
49 silly fetch manifest @angular/router@~12.2.14
50 http fetch GET 200 https://registry.npmjs.org/@angular%2frouter 150ms (cache updated)
51 silly fetch manifest @angular-devkit/build-angular@~12.2.14
52 http fetch GET 200 https://registry.npmjs.org/@angular-devkit%2fbuild-angular 6ms (cache hit)
53 silly fetch manifest @angular/compiler-cli@~12.2.14
54 http fetch GET 200 https://registry.npmjs.org/@angular%2fcompiler-cli 163ms (cache updated)
55 silly fetch manifest typescript@~4.3.5
56 http fetch GET 200 https://registry.npmjs.org/typescript 860ms (cache updated)
57 silly fetch manifest @angular/localize@^12.0.0
58 http fetch GET 200 https://registry.npmjs.org/@angular%2flocalize 120ms (cache updated)
59 silly fetch manifest @angular/service-worker@^12.0.0
60 http fetch GET 200 https://registry.npmjs.org/@angular%2fservice-worker 153ms (cache updated)
61 silly fetch manifest karma@~6.3.9
62 http fetch GET 200 https://registry.npmjs.org/karma 3ms (cache hit)
63 silly fetch manifest ng-packagr@^12.2.5
64 http fetch GET 200 https://registry.npmjs.org/ng-packagr 3ms (cache hit)
65 silly fetch manifest tslib@^2.0.0
66 http fetch GET 200 https://registry.npmjs.org/tslib 5ms (cache hit)
67 silly fetch manifest protractor@~7.0.0
68 http fetch GET 200 https://registry.npmjs.org/protractor 52ms (cache revalidated)
69 silly fetch manifest tailwindcss@^2.0.0
70 http fetch GET 200 https://registry.npmjs.org/tailwindcss 181ms (cache updated)
71 silly fetch manifest autoprefixer@^10.0.2
72 http fetch GET 200 https://registry.npmjs.org/autoprefixer 3ms (cache hit)
73 silly fetch manifest postcss@^8.1.0
74 http fetch GET 200 https://registry.npmjs.org/postcss 5ms (cache hit)
75 silly fetch manifest tslint@~6.1.0
76 http fetch GET 200 https://registry.npmjs.org/tslint 50ms (cache revalidated)
77 silly fetch manifest @angular/cli@~12.2.14
78 http fetch GET 200 https://registry.npmjs.org/@angular%2fcli 7ms (cache hit)
79 timing idealTree Completed in 3808ms
80 timing command:install Completed in 3815ms
81 verbose stack Error: could not resolve
81 verbose stack     at PlaceDep.failPeerConflict (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:544:25)
81 verbose stack     at PlaceDep.place (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:197:21)
81 verbose stack     at new PlaceDep (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:71:10)
81 verbose stack     at /home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:944:31
81 verbose stack     at Array.map (<anonymous>)
81 verbose stack     at Arborist.[buildDepStep] (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:944:8)
81 verbose stack     at async Arborist.buildIdealTree (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:216:7)
81 verbose stack     at async Promise.all (index 1)
81 verbose stack     at async Arborist.reify (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:149:5)
81 verbose stack     at async Install.install (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/lib/install.js:170:5)
82 verbose cwd __PROJECT__
83 verbose Linux 5.4.72-microsoft-standard-WSL2
84 verbose argv "/home/mwaibel/bin/node-v16.13.0-linux-x64/bin/node" "/home/mwaibel/bin/node-v16.13.0-linux-x64/bin/npm" "install" "--quiet"
85 verbose node v16.13.0
86 verbose npm  v8.1.0
87 error code ERESOLVE
88 error ERESOLVE could not resolve
89 error
90 error While resolving: __PROJECT_NAME__@1.6.2
90 error Found: @angular-devkit/build-angular@0.1101.3
90 error node_modules/@angular-devkit/build-angular
90 error   dev @angular-devkit/build-angular@"~12.2.14" from the root project
90 error
90 error Could not resolve dependency:
90 error dev @angular-devkit/build-angular@"~12.2.14" from the root project
90 error
90 error Conflicting peer dependency: @angular/compiler-cli@12.2.14
90 error node_modules/@angular/compiler-cli
90 error   peer @angular/compiler-cli@"^12.0.0" from @angular-devkit/build-angular@12.2.14
90 error   node_modules/@angular-devkit/build-angular
90 error     dev @angular-devkit/build-angular@"~12.2.14" from the root project
90 error
90 error Fix the upstream dependency conflict, or retry
90 error this command with --force, or --legacy-peer-deps
90 error to accept an incorrect (and potentially broken) dependency resolution.
90 error
90 error See /home/mwaibel/.npm/eresolve-report.txt for a full report.
91 verbose exit 1

/home/mwaibel/.npm/eresolve-report.txt

# npm resolution error report

2021-12-08T09:00:47.031Z

While resolving: __PROJECT_NAME__@1.6.2
Found: @angular-devkit/build-angular@0.1101.3
node_modules/@angular-devkit/build-angular
  dev @angular-devkit/build-angular@"~12.2.14" from the root project

Could not resolve dependency:
dev @angular-devkit/build-angular@"~12.2.14" from the root project

Conflicting peer dependency: @angular/compiler-cli@12.2.14
node_modules/@angular/compiler-cli
  peer @angular/compiler-cli@"^12.0.0" from @angular-devkit/build-angular@12.2.14
  node_modules/@angular-devkit/build-angular
    dev @angular-devkit/build-angular@"~12.2.14" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
  "edge": {
    "type": "dev",
    "name": "@angular-devkit/build-angular",
    "spec": "~12.2.14",
    "error": "INVALID",
    "from": {
      "location": "__PROJECT__"
    }
  },
  "dep": {
    "name": "@angular-devkit/build-angular",
    "version": "12.2.14",
    "whileInstalling": {
      "name": "__PROJECT_NAME__",
      "version": "1.6.2",
      "path": "__PROJECT__"
    },
    "location": "node_modules/@angular-devkit/build-angular",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "@angular-devkit/build-angular",
        "spec": "~12.2.14",
        "error": "INVALID",
        "from": {
          "location": "__PROJECT__"
        }
      }
    ]
  },
  "current": {
    "name": "@angular-devkit/build-angular",
    "version": "0.1101.3",
    "location": "node_modules/@angular-devkit/build-angular",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "@angular-devkit/build-angular",
        "spec": "~12.2.14",
        "error": "INVALID",
        "from": {
          "location": "__PROJECT__"
        }
      }
    ]
  },
  "peerConflict": {
    "current": {
      "name": "@angular/compiler-cli",
      "version": "11.1.2",
      "location": "node_modules/@angular/compiler-cli",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "dev",
          "name": "@angular/compiler-cli",
          "spec": "~12.2.14",
          "error": "INVALID",
          "from": {
            "location": "__PROJECT__"
          }
        },
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^11.0.0",
          "from": {
            "name": "@angular-devkit/build-angular",
            "version": "0.1101.3",
            "location": "node_modules/@angular-devkit/build-angular",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "dev",
                "name": "@angular-devkit/build-angular",
                "spec": "~12.2.14",
                "error": "INVALID",
                "from": {
                  "location": "__PROJECT__"
                }
              }
            ]
          }
        },
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^11.0.0",
          "from": {
            "name": "@ngtools/webpack",
            "version": "11.1.3",
            "location": "node_modules/@ngtools/webpack",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "prod",
                "name": "@ngtools/webpack",
                "spec": "11.1.3",
                "from": {
                  "name": "@angular-devkit/build-angular",
                  "version": "0.1101.3",
                  "location": "node_modules/@angular-devkit/build-angular",
                  "isWorkspace": false,
                  "dependents": [
                    {
                      "type": "dev",
                      "name": "@angular-devkit/build-angular",
                      "spec": "~12.2.14",
                      "error": "INVALID",
                      "from": {
                        "location": "__PROJECT__"
                      }
                    }
                  ]
                }
              }
            ]
          }
        },
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^11.0.0",
          "from": {
            "name": "ng-packagr",
            "version": "11.1.4",
            "location": "node_modules/ng-packagr",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "dev",
                "name": "ng-packagr",
                "spec": "^12.2.5",
                "error": "INVALID",
                "from": {
                  "location": "__PROJECT__"
                }
              },
              {
                "type": "peerOptional",
                "name": "ng-packagr",
                "spec": "^11.0.0",
                "from": {
                  "name": "@angular-devkit/build-angular",
                  "version": "0.1101.3",
                  "location": "node_modules/@angular-devkit/build-angular",
                  "isWorkspace": false,
                  "dependents": [
                    {
                      "type": "dev",
                      "name": "@angular-devkit/build-angular",
                      "spec": "~12.2.14",
                      "error": "INVALID",
                      "from": {
                        "location": "__PROJECT__"
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    },
    "peer": {
      "name": "@angular/compiler-cli",
      "version": "12.2.14",
      "whileInstalling": {
        "name": "__PROJECT_NAME__",
        "version": "1.6.2",
        "path": "__PROJECT__"
      },
      "location": "node_modules/@angular/compiler-cli",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^12.0.0",
          "from": {
            "name": "@angular-devkit/build-angular",
            "version": "12.2.14",
            "whileInstalling": {
              "name": "__PROJECT_NAME__",
              "version": "1.6.2",
              "path": "__PROJECT__"
            },
            "location": "node_modules/@angular-devkit/build-angular",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "dev",
                "name": "@angular-devkit/build-angular",
                "spec": "~12.2.14",
                "error": "INVALID",
                "from": {
                  "location": "__PROJECT__"
                }
              }
            ]
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false,
  "isMine": true
}

v12 to v13

This uses npm@8

Command output

$ npx @angular/cli@13 update @angular/core@13 @angular/cli@13
Need to install the following packages:
  @angular/cli@13
Ok to proceed? (y) y
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 13.0.4 to perform the update.
✔ Package successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 38 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular-devkit/build-angular @ "13.0.4" (was "12.2.14")...
    Updating package.json with dependency @angular/cli @ "13.0.4" (was "12.2.14")...
    Updating package.json with dependency @angular/compiler-cli @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency ng-packagr @ "13.0.8" (was "12.2.5")...
    Updating package.json with dependency typescript @ "4.4.4" (was "4.3.5")...
    Updating package.json with dependency @angular/animations @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency @angular/common @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency @angular/compiler @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency @angular/core @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency @angular/forms @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency @angular/platform-browser @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency @angular/router @ "13.0.3" (was "12.2.14")...
    Updating package.json with dependency tslib @ "2.3.1" (was "2.1.0")...
  UPDATE package.json (1555 bytes)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: __PROJECT_NAME__@1.6.2
npm ERR! Found: @angular-devkit/build-angular@12.2.14
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"~13.0.4" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~13.0.4" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/compiler-cli@13.0.3
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/build-angular@13.0.4
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~13.0.4" 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 /home/mwaibel/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mwaibel/.npm/_logs/2021-12-08T09_48_51_880Z-debug.log
✖ Package install failed, see above.

The debug log:

0 verbose cli [
0 verbose cli   '/home/mwaibel/bin/node-v16.13.0-linux-x64/bin/node',
0 verbose cli   '/home/mwaibel/bin/node-v16.13.0-linux-x64/bin/npm',
0 verbose cli   'install',
0 verbose cli   '--quiet'
0 verbose cli ]
1 info using npm@8.1.0
2 info using node@v16.13.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:__PROJECT__/.npmrc Completed in 1ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/home/mwaibel/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/home/mwaibel/bin/node-v16.13.0-linux-x64/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 6ms
19 timing npm:load:configload Completed in 7ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 1ms
22 timing config:load:flatten Completed in 1ms
23 timing npm:load:cleanupLog Completed in 2ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 0ms
26 timing npm:load Completed in 11ms
27 timing arborist:ctor Completed in 1ms
28 timing idealTree:init Completed in 543ms
29 timing idealTree:userRequests Completed in 0ms
30 silly idealTree buildDeps
31 silly fetch manifest @angular/animations@~13.0.3
32 http fetch GET 200 https://registry.npmjs.org/@angular%2fanimations 189ms (cache revalidated)
33 silly fetch manifest @angular/core@~13.0.3
34 http fetch GET 200 https://registry.npmjs.org/@angular%2fcore 70ms (cache revalidated)
35 silly fetch manifest rxjs@~6.6.0
36 http fetch GET 200 https://registry.npmjs.org/rxjs 5ms (cache hit)
37 silly fetch manifest zone.js@~0.11.4
38 http fetch GET 200 https://registry.npmjs.org/zone.js 49ms (cache revalidated)
39 silly fetch manifest @angular/common@~13.0.3
40 http fetch GET 200 https://registry.npmjs.org/@angular%2fcommon 68ms (cache revalidated)
41 silly fetch manifest @angular/compiler@~13.0.3
42 http fetch GET 200 https://registry.npmjs.org/@angular%2fcompiler 72ms (cache revalidated)
43 silly fetch manifest @angular/forms@~13.0.3
44 http fetch GET 200 https://registry.npmjs.org/@angular%2fforms 62ms (cache revalidated)
45 silly fetch manifest @angular/platform-browser@~13.0.3
46 http fetch GET 200 https://registry.npmjs.org/@angular%2fplatform-browser 69ms (cache revalidated)
47 silly fetch manifest @angular/platform-browser-dynamic@~13.0.3
48 http fetch GET 200 https://registry.npmjs.org/@angular%2fplatform-browser-dynamic 57ms (cache revalidated)
49 silly fetch manifest @angular/router@~13.0.3
50 http fetch GET 200 https://registry.npmjs.org/@angular%2frouter 61ms (cache revalidated)
51 silly fetch manifest tslib@^2.3.1
52 http fetch GET 200 https://registry.npmjs.org/tslib 6ms (cache hit)
53 silly fetch manifest @angular-devkit/build-angular@~13.0.4
54 http fetch GET 200 https://registry.npmjs.org/@angular-devkit%2fbuild-angular 5ms (cache hit)
55 silly fetch manifest @angular/compiler-cli@~13.0.3
56 http fetch GET 200 https://registry.npmjs.org/@angular%2fcompiler-cli 58ms (cache revalidated)
57 silly fetch manifest typescript@~4.4.4
58 http fetch GET 200 https://registry.npmjs.org/typescript 92ms (cache revalidated)
59 silly fetch manifest @angular/localize@^13.0.0
60 http fetch GET 200 https://registry.npmjs.org/@angular%2flocalize 70ms (cache revalidated)
61 silly fetch manifest @angular/service-worker@^13.0.0
62 http fetch GET 200 https://registry.npmjs.org/@angular%2fservice-worker 69ms (cache revalidated)
63 silly fetch manifest karma@~6.3.9
64 http fetch GET 200 https://registry.npmjs.org/karma 57ms (cache revalidated)
65 silly fetch manifest ng-packagr@^13.0.8
66 http fetch GET 200 https://registry.npmjs.org/ng-packagr 53ms (cache revalidated)
67 silly fetch manifest protractor@~7.0.0
68 http fetch GET 200 https://registry.npmjs.org/protractor 64ms (cache revalidated)
69 silly fetch manifest tailwindcss@^2.0.0
70 http fetch GET 200 https://registry.npmjs.org/tailwindcss 66ms (cache revalidated)
71 silly fetch manifest autoprefixer@^10.0.2
72 http fetch GET 200 https://registry.npmjs.org/autoprefixer 54ms (cache revalidated)
73 silly fetch manifest postcss@^8.1.0
74 http fetch GET 200 https://registry.npmjs.org/postcss 56ms (cache revalidated)
75 silly fetch manifest @angular/cli@~13.0.4
76 http fetch GET 200 https://registry.npmjs.org/@angular%2fcli 5ms (cache hit)
77 timing idealTree Completed in 2025ms
78 timing command:install Completed in 2032ms
79 verbose stack Error: could not resolve
79 verbose stack     at PlaceDep.failPeerConflict (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:544:25)
79 verbose stack     at PlaceDep.place (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:197:21)
79 verbose stack     at new PlaceDep (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:71:10)
79 verbose stack     at /home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:944:31
79 verbose stack     at Array.map (<anonymous>)
79 verbose stack     at Arborist.[buildDepStep] (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:944:8)
79 verbose stack     at async Arborist.buildIdealTree (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:216:7)
79 verbose stack     at async Promise.all (index 1)
79 verbose stack     at async Arborist.reify (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:149:5)
79 verbose stack     at async Install.install (/home/mwaibel/bin/node-v16.13.0-linux-x64/lib/node_modules/npm/lib/install.js:170:5)
80 verbose cwd __PROJECT__
81 verbose Linux 5.4.72-microsoft-standard-WSL2
82 verbose argv "/home/mwaibel/bin/node-v16.13.0-linux-x64/bin/node" "/home/mwaibel/bin/node-v16.13.0-linux-x64/bin/npm" "install" "--quiet"
83 verbose node v16.13.0
84 verbose npm  v8.1.0
85 error code ERESOLVE
86 error ERESOLVE could not resolve
87 error
88 error While resolving: __PROJECT_NAME__@1.6.2
88 error Found: @angular-devkit/build-angular@12.2.14
88 error node_modules/@angular-devkit/build-angular
88 error   dev @angular-devkit/build-angular@"~13.0.4" from the root project
88 error
88 error Could not resolve dependency:
88 error dev @angular-devkit/build-angular@"~13.0.4" from the root project
88 error
88 error Conflicting peer dependency: @angular/compiler-cli@13.0.3
88 error node_modules/@angular/compiler-cli
88 error   peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/build-angular@13.0.4
88 error   node_modules/@angular-devkit/build-angular
88 error     dev @angular-devkit/build-angular@"~13.0.4" from the root project
88 error
88 error Fix the upstream dependency conflict, or retry
88 error this command with --force, or --legacy-peer-deps
88 error to accept an incorrect (and potentially broken) dependency resolution.
88 error
88 error See /home/mwaibel/.npm/eresolve-report.txt for a full report.
89 verbose exit 1

eresolve-report.txt

# npm resolution error report

2021-12-08T09:48:51.879Z

While resolving: __PROJECT_NAME__@1.6.2
Found: @angular-devkit/build-angular@12.2.14
node_modules/@angular-devkit/build-angular
  dev @angular-devkit/build-angular@"~13.0.4" from the root project

Could not resolve dependency:
dev @angular-devkit/build-angular@"~13.0.4" from the root project

Conflicting peer dependency: @angular/compiler-cli@13.0.3
node_modules/@angular/compiler-cli
  peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/build-angular@13.0.4
  node_modules/@angular-devkit/build-angular
    dev @angular-devkit/build-angular@"~13.0.4" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
  "edge": {
    "type": "dev",
    "name": "@angular-devkit/build-angular",
    "spec": "~13.0.4",
    "error": "INVALID",
    "from": {
      "location": "__PROJECT__"
    }
  },
  "dep": {
    "name": "@angular-devkit/build-angular",
    "version": "13.0.4",
    "whileInstalling": {
      "name": "__PROJECT_NAME__",
      "version": "1.6.2",
      "path": "__PROJECT__"
    },
    "location": "node_modules/@angular-devkit/build-angular",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "@angular-devkit/build-angular",
        "spec": "~13.0.4",
        "error": "INVALID",
        "from": {
          "location": "__PROJECT__"
        }
      }
    ]
  },
  "current": {
    "name": "@angular-devkit/build-angular",
    "version": "12.2.14",
    "location": "node_modules/@angular-devkit/build-angular",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "@angular-devkit/build-angular",
        "spec": "~13.0.4",
        "error": "INVALID",
        "from": {
          "location": "__PROJECT__"
        }
      }
    ]
  },
  "peerConflict": {
    "current": {
      "name": "@angular/compiler-cli",
      "version": "12.2.14",
      "location": "node_modules/@angular/compiler-cli",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "dev",
          "name": "@angular/compiler-cli",
          "spec": "~13.0.3",
          "error": "INVALID",
          "from": {
            "location": "__PROJECT__"
          }
        },
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^12.0.0",
          "from": {
            "name": "@angular-devkit/build-angular",
            "version": "12.2.14",
            "location": "node_modules/@angular-devkit/build-angular",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "dev",
                "name": "@angular-devkit/build-angular",
                "spec": "~13.0.4",
                "error": "INVALID",
                "from": {
                  "location": "__PROJECT__"
                }
              }
            ]
          }
        },
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^12.0.0",
          "from": {
            "name": "@ngtools/webpack",
            "version": "12.2.14",
            "location": "node_modules/@ngtools/webpack",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "prod",
                "name": "@ngtools/webpack",
                "spec": "12.2.14",
                "from": {
                  "name": "@angular-devkit/build-angular",
                  "version": "12.2.14",
                  "location": "node_modules/@angular-devkit/build-angular",
                  "isWorkspace": false,
                  "dependents": [
                    {
                      "type": "dev",
                      "name": "@angular-devkit/build-angular",
                      "spec": "~13.0.4",
                      "error": "INVALID",
                      "from": {
                        "location": "__PROJECT__"
                      }
                    }
                  ]
                }
              }
            ]
          }
        },
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^12.0.0 || ^12.2.0-next.0",
          "from": {
            "name": "ng-packagr",
            "version": "12.2.5",
            "location": "node_modules/ng-packagr",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "dev",
                "name": "ng-packagr",
                "spec": "^13.0.8",
                "error": "INVALID",
                "from": {
                  "location": "__PROJECT__"
                }
              },
              {
                "type": "peerOptional",
                "name": "ng-packagr",
                "spec": "^12.0.0",
                "from": {
                  "name": "@angular-devkit/build-angular",
                  "version": "12.2.14",
                  "location": "node_modules/@angular-devkit/build-angular",
                  "isWorkspace": false,
                  "dependents": [
                    {
                      "type": "dev",
                      "name": "@angular-devkit/build-angular",
                      "spec": "~13.0.4",
                      "error": "INVALID",
                      "from": {
                        "location": "__PROJECT__"
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    },
    "peer": {
      "name": "@angular/compiler-cli",
      "version": "13.0.3",
      "whileInstalling": {
        "name": "__PROJECT_NAME__",
        "version": "1.6.2",
        "path": "__PROJECT__"
      },
      "location": "node_modules/@angular/compiler-cli",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^13.0.0",
          "from": {
            "name": "@angular-devkit/build-angular",
            "version": "13.0.4",
            "whileInstalling": {
              "name": "__PROJECT_NAME__",
              "version": "1.6.2",
              "path": "__PROJECT__"
            },
            "location": "node_modules/@angular-devkit/build-angular",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "dev",
                "name": "@angular-devkit/build-angular",
                "spec": "~13.0.4",
                "error": "INVALID",
                "from": {
                  "location": "__PROJECT__"
                }
              }
            ]
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false,
  "isMine": true
}

I encountered the similar issues too. Have you solved them ? Can you give me any sugetions? @mwaibel-go

I believe the issue stems from the fact that npm changed how it resolved peer dependencies starting from version 7 (https://stackoverflow.com/a/66620869). Instead of using the --force flag, --legacy-peer-deps suffices. You can let the migration fail and then run npm install --legacy-peer-deps.

If you want the migration to work in the first place, you might have luck by creating an .npmrc file as sibling to .package.json. If you specified legacy-peer-deps = true there, the Angular migration might pick up on it. I haven’t tried that though, and the npm documentation is not very explicit about the syntax for boolean values, so that might be wrong, too.