angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Dependency issue with 13.1.0

Open phristov opened this issue 4 years ago • 28 comments

🐞 Bug report

Can you pin-point the command or commands that are effected by this bug?

  • [x ] new

Did this behavior use to work in the previous version? Yes Yes, the previous version in which this bug was not present was: 13.0.0

Description

After I run ng new, npm is returning errors.

🔬 Minimal Reproduction

Angular CLI: 13.1.0
Node: 16.13.1
Package Manager: npm 8.1.2
OS: win32 x64

Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1301.0 (cli-only)
@angular-devkit/core         13.1.0 (cli-only)
@angular-devkit/schematics   13.1.0 (cli-only)
@schematics/angular          13.1.0 (cli-only)
npm install -g @angular/cli
ng new t1we

Log

? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? SCSS   [ https://sass-lang.com/documentation/syntax#scss                ]
CREATE t1we/angular.json (3195 bytes)
CREATE t1we/package.json (1068 bytes)
CREATE t1we/README.md (1050 bytes)
CREATE t1we/tsconfig.json (863 bytes)
CREATE t1we/.editorconfig (274 bytes)
CREATE t1we/.gitignore (620 bytes)
CREATE t1we/.browserslistrc (600 bytes)
CREATE t1we/karma.conf.js (1421 bytes)
CREATE t1we/tsconfig.app.json (287 bytes)
CREATE t1we/tsconfig.spec.json (333 bytes)
CREATE t1we/.vscode/extensions.json (130 bytes)
CREATE t1we/.vscode/launch.json (474 bytes)
CREATE t1we/.vscode/tasks.json (938 bytes)
CREATE t1we/src/favicon.ico (948 bytes)
CREATE t1we/src/index.html (290 bytes)
CREATE t1we/src/main.ts (372 bytes)
CREATE t1we/src/polyfills.ts (2338 bytes)
CREATE t1we/src/styles.scss (80 bytes)
CREATE t1we/src/test.ts (745 bytes)
CREATE t1we/src/assets/.gitkeep (0 bytes)
CREATE t1we/src/environments/environment.prod.ts (51 bytes)
CREATE t1we/src/environments/environment.ts (658 bytes)
CREATE t1we/src/app/app-routing.module.ts (245 bytes)
CREATE t1we/src/app/app.module.ts (393 bytes)
CREATE t1we/src/app/app.component.html (23364 bytes)
CREATE t1we/src/app/app.component.spec.ts (1067 bytes)
CREATE t1we/src/app/app.component.ts (209 bytes)
CREATE t1we/src/app/app.component.scss (0 bytes)
⠹ Installing packages (npm)...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/typescript
npm ERR!   dev typescript@"~4.5.2" from the root project
npm ERR!   peer typescript@">=4.4.3 <4.6" from @angular-devkit/[email protected]
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~13.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@">=4.4.2 <4.5" from @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"~13.0.0" from the root project
npm ERR!   peer @angular/compiler-cli@"^13.0.0 || ^13.1.0-next" from @angular-devkit/[email protected]
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~13.1.0" 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 C:\Users\x\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\x\AppData\Local\npm-cache\_logs\2021-12-10T07_17_11_880Z-debug.log
✖ Package install failed, see above.
The Schematic workflow failed. See above.

Report

# npm resolution error report

2021-12-10T07:17:51.863Z

While resolving: [email protected]
Found: [email protected]
node_modules/typescript
  dev typescript@"~4.5.2" from the root project
  peer typescript@">=4.4.3 <4.6" from @angular-devkit/[email protected]
  node_modules/@angular-devkit/build-angular
    dev @angular-devkit/build-angular@"~13.1.0" from the root project

Could not resolve dependency:
peer typescript@">=4.4.2 <4.5" from @angular/[email protected]
node_modules/@angular/compiler-cli
  dev @angular/compiler-cli@"~13.0.0" from the root project
  peer @angular/compiler-cli@"^13.0.0 || ^13.1.0-next" from @angular-devkit/[email protected]
  node_modules/@angular-devkit/build-angular
    dev @angular-devkit/build-angular@"~13.1.0" 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",
  "current": {
    "name": "typescript",
    "version": "4.5.3",
    "whileInstalling": {
      "name": "t1weqwe",
      "version": "0.0.0",
      "path": "D:\\projects\\t1weqwe"
    },
    "location": "node_modules/typescript",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "typescript",
        "spec": "~4.5.2",
        "from": {
          "location": "D:\\projects\\t1weqwe"
        }
      },
      {
        "type": "peer",
        "name": "typescript",
        "spec": ">=4.4.3 <4.6",
        "from": {
          "name": "@angular-devkit/build-angular",
          "version": "13.1.0",
          "whileInstalling": {
            "name": "t1weqwe",
            "version": "0.0.0",
            "path": "D:\\projects\\t1weqwe"
          },
          "location": "node_modules/@angular-devkit/build-angular",
          "isWorkspace": false,
          "dependents": [
            {
              "type": "dev",
              "name": "@angular-devkit/build-angular",
              "spec": "~13.1.0",
              "from": {
                "location": "D:\\projects\\t1weqwe"
              }
            }
          ]
        }
      }
    ]
  },
  "currentEdge": {
    "type": "dev",
    "name": "typescript",
    "spec": "~4.5.2",
    "from": {
      "location": "D:\\projects\\t1weqwe"
    }
  },
  "edge": {
    "type": "peer",
    "name": "typescript",
    "spec": ">=4.4.2 <4.5",
    "error": "INVALID",
    "from": {
      "name": "@angular/compiler-cli",
      "version": "13.0.3",
      "whileInstalling": {
        "name": "t1weqwe",
        "version": "0.0.0",
        "path": "D:\\projects\\t1weqwe"
      },
      "location": "node_modules/@angular/compiler-cli",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "dev",
          "name": "@angular/compiler-cli",
          "spec": "~13.0.0",
          "from": {
            "location": "D:\\projects\\t1weqwe"
          }
        },
        {
          "type": "peer",
          "name": "@angular/compiler-cli",
          "spec": "^13.0.0 || ^13.1.0-next",
          "from": {
            "name": "@angular-devkit/build-angular",
            "version": "13.1.0",
            "whileInstalling": {
              "name": "t1weqwe",
              "version": "0.0.0",
              "path": "D:\\projects\\t1weqwe"
            },
            "location": "node_modules/@angular-devkit/build-angular",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "dev",
                "name": "@angular-devkit/build-angular",
                "spec": "~13.1.0",
                "from": {
                  "location": "D:\\projects\\t1weqwe"
                }
              }
            ]
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false
}

phristov avatar Dec 10 '21 07:12 phristov

This should be fixed by #22334

cexbrayat avatar Dec 10 '21 07:12 cexbrayat

Closed via https://github.com/angular/angular-cli/pull/22334

alan-agius4 avatar Dec 10 '21 10:12 alan-agius4

Hi! Once you fix it, what do I need to do before trying again?

nicosoutn2014 avatar Dec 10 '21 12:12 nicosoutn2014

For quick fix, using node v14.18.2 instead works for me ( replaced node 16.x.x ).

abngal avatar Dec 10 '21 12:12 abngal

@abngal It keeps throwing me the error for typescript version, should I downgrade it to 4.4.3?

nicosoutn2014 avatar Dec 10 '21 13:12 nicosoutn2014

You should update the Angular packages to v13.1.0 (which supports TS 4.5). This is what the PR fixed, and it will be released in the next CLI version.

cexbrayat avatar Dec 10 '21 13:12 cexbrayat

Until that is released, what version of @angular/* works with 13.1.0 of the CLI? Been unable to update to the 13.0.4 versions for the past week because of version issues between the cli and angular and was hoping now that everything was 13.1.0 that it would all work.

bryantlikes avatar Dec 10 '21 16:12 bryantlikes

If you use 13.1.0 for all Angular packages (framework and cli), then everything works out of the box. If you want to stay on Angular v13.0.x then the CLI v13.1 works as well, but you'll have to use TS v4.4 instead of TS v4.5.

cexbrayat avatar Dec 10 '21 16:12 cexbrayat

Please update to the most recent version 13.1.1 to resolve the problem.

alan-agius4 avatar Dec 10 '21 20:12 alan-agius4

My environment

Angular CLI: 13.1.1
Node: 16.13.0
Package Manager: npm 8.1.0
OS: win32 x64

Angular: <error>
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1301.1 (cli-only)
@angular-devkit/build-angular   <error>
@angular-devkit/core            13.1.1 (cli-only)
@angular-devkit/schematics      13.1.1 (cli-only)
@angular/cli                    13.1.1 (cli-only)
@schematics/angular             13.1.1 (cli-only)
rxjs                            6.6.7 (cli-only)
typescript                      <error>

Still same error at update ng12 to ng13 with Angular CLI: 13.1.1

PS D:\Documents\dev\amzmation-app> npx @angular/cli@13 update @angular/core@13 @angular/cli@13
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 13.1.1 to perform the update.
✔ Package successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 55 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular-devkit/build-angular @ "13.1.1" (was "12.2.14")...
    Updating package.json with dependency @angular/cli @ "13.1.1" (was "12.2.14")...
    Updating package.json with dependency @angular/compiler-cli @ "13.1.0" (was "12.2.14")...
    Updating package.json with dependency @angular/language-service @ "13.1.0" (was "12.2.14")...
    Updating package.json with dependency typescript @ "4.5.4" (was "4.3.5")...
    Updating package.json with dependency @angular/animations @ "13.1.0" (was "12.2.14")...
    Updating package.json with dependency @angular/common @ "13.1.0" (was "12.2.14")...
    Updating package.json with dependency @angular/compiler @ "13.1.0" (was "12.2.14")...
    Updating package.json with dependency @angular/core @ "13.1.0" (was "12.2.14")...
    Updating package.json with dependency @angular/forms @ "13.1.0" (was "12.2.14")...
    Updating package.json with dependency @angular/platform-browser @ "13.1.0" (was "12.2.14")...
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@"^13.0.0 || ^13.1.0-next" from @angular-devkit/[email protected]
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"^13.1.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 ERR!
npm ERR! See C:\Users\Alons\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Alons\AppData\Local\npm-cache\_logs\2021-12-14T23_20_58_614Z-debug.log

AlonsoK28 avatar Dec 14 '21 23:12 AlonsoK28

`The installed local Angular CLI version is older than the latest stable version.

Installing a temporary version to perform the update. ✔ Package successfully installed. Using package manager: 'npm' Collecting installed dependencies... Found 52 dependencies. Fetching dependency metadata from registry... Updating package.json with dependency @angular-devkit/build-angular @ "13.1.2" (was "12.2.6")... Updating package.json with dependency @angular/cli @ "13.1.2" (was "12.2.6")... Updating package.json with dependency @angular/compiler-cli @ "13.1.1" (was "12.2.6")... Updating package.json with dependency ng-packagr @ "13.1.2" (was "12.2.1")... Updating package.json with dependency typescript @ "4.5.4" (was "4.3.5")... Updating package.json with dependency @angular/animations @ "13.1.1" (was "12.2.6")... Updating package.json with dependency @angular/common @ "13.1.1" (was "12.2.6")... Updating package.json with dependency @angular/compiler @ "13.1.1" (was "12.2.6")... Updating package.json with dependency @angular/core @ "13.1.1" (was "12.2.6")... Updating package.json with dependency @angular/forms @ "13.1.1" (was "12.2.6")... Updating package.json with dependency @angular/platform-browser @ "13.1.1" (was "12.2.6")... Updating package.json with dependency @angular/platform-browser-dynamic @ "13.1.1" (was "12.2.6")... Updating package.json with dependency @angular/router @ "13.1.1" (was "12.2.6")... UPDATE package.json (3455 bytes) npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: @angular-devkit/[email protected] npm ERR! node_modules/@angular-devkit/build-angular npm ERR! dev @angular-devkit/build-angular@"^13.1.2" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! dev @angular-devkit/build-angular@"^13.1.2" from the root project npm ERR! npm ERR! Conflicting peer dependency: @angular/[email protected] npm ERR! node_modules/@angular/compiler-cli npm ERR! peer @angular/compiler-cli@"^13.0.0 || ^13.1.0-next" from @angular-devkit/[email protected] npm ERR! node_modules/@angular-devkit/build-angular npm ERR! dev @angular-devkit/build-angular@"^13.1.2" 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 /Users/dmitriydementor/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/user1/.npm/_logs/2021-12-20T13_26_02_337Z-debug.log ✖ Package install failed, see above.`

I have a similar problem when upgrading from 12 to 13 version, here is my ng version info

`Angular CLI: 12.2.5 Node: 14.16.0 Package Manager: npm 7.21.1 OS: darwin x64

Angular: ... animations, cdk, common, compiler, compiler-cli, core, forms ... material, material-moment-adapter, platform-browser ... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1202.5 (cli-only) @angular-devkit/build-angular @angular-devkit/core 12.2.5 (cli-only) @angular-devkit/schematics 12.2.5 (cli-only) @angular/cli 12.2.5 (cli-only) @schematics/angular 12.2.5 (cli-only) ng-packagr rxjs 6.6.7 (cli-only) typescript `

dmitriydementor avatar Dec 20 '21 13:12 dmitriydementor

Lately using ng update for updating Angular and its angular modules are an increasing pain.

Every time there is a new version of angular something always brakes with ERR! code ERESOLVE and with angular's own dependencies.

Just updating @angular/core to 13.1.2 thowed me an error with @angular/animations.

blogcraft avatar Jan 12 '22 19:01 blogcraft

This is still broken

mrtpain avatar Jan 14 '22 18:01 mrtpain

@cexbrayat

Been working on a project for about a month with no issues using v13.1.0 and went to upgrade this morning and with all of the failures, I was struggling. Later this evening I will provide the errors I am seeing. Primarily has to do with animations.

node version => v16.13.1 npm version =>8.1.2 ng update @angular/cli@^13 @angular/core@^13 The installed Angular CLI version is outdated. Installing a temporary Angular CLI versioned 13.1.4 to perform the update. ✔ Package successfully installed. Using package manager: 'npm' Collecting installed dependencies... Found 25 dependencies. Fetching dependency metadata from registry... Updating package.json with dependency @angular-devkit/build-angular @ "13.1.4" (was "13.1.1")... Updating package.json with dependency @angular/cli @ "13.1.4" (was "13.1.1")... Updating package.json with dependency @angular/compiler-cli @ "13.1.3" (was "13.1.0")... Updating package.json with dependency @angular/animations @ "13.1.3" (was "13.1.0")... Updating package.json with dependency @angular/common @ "13.1.3" (was "13.1.0")... Updating package.json with dependency @angular/compiler @ "13.1.3" (was "13.1.0")... Updating package.json with dependency @angular/core @ "13.1.3" (was "13.1.0")... Updating package.json with dependency @angular/forms @ "13.1.3" (was "13.1.0")... Updating package.json with dependency @angular/platform-browser @ "13.1.3" (was "13.1.0")... Updating package.json with dependency @angular/platform-browser-dynamic @ "13.1.3" (was "13.1.0")... Updating package.json with dependency @angular/router @ "13.1.3" (was "13.1.0")... UPDATE package.json (1136 bytes) npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: @angular-devkit/[email protected] npm ERR! node_modules/@angular-devkit/build-angular npm ERR! dev @angular-devkit/build-angular@"~13.1.4" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! dev @angular-devkit/build-angular@"~13.1.4" from the root project npm ERR! npm ERR! Conflicting peer dependency: @angular/[email protected] npm ERR! node_modules/@angular/core npm ERR! peer @angular/core@"13.1.3" from @angular/[email protected] npm ERR! node_modules/@angular/service-worker npm ERR! peerOptional @angular/service-worker@"^13.0.0 || ^13.1.0-next" from @angular-devkit/[email protected] npm ERR! node_modules/@angular-devkit/build-angular npm ERR! dev @angular-devkit/build-angular@"~13.1.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!

This project was started on 13.1.0. I am trying to do an update as a result of github identifying a medium vulnerability in node-forge. I also tried with force but the issues seemed to have gotten worse. So I completely backed out of the update. Thoughts on being able to do what seems to be a minor update as the Angular team recommends?

jayhamilton avatar Jan 24 '22 13:01 jayhamilton

cexbrayat this does not seem to be fixed and I still constantly run into this issue.

Angular CLI: 13.2.3
Node: 16.13.2
Package Manager: npm 8.1.4
OS: win32 x64

Angular: 13.2.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.3
@angular-devkit/build-angular   13.2.3
@angular-devkit/core            13.2.3
@angular-devkit/schematics      13.2.3
@angular/cli                    13.2.3
@schematics/angular             13.2.3
rxjs                            7.5.2
typescript                      4.5.4

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: @angular-devkit/[email protected] npm ERR! node_modules/@angular-devkit/build-angular npm ERR! dev @angular-devkit/build-angular@"~13.2.3" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! dev @angular-devkit/build-angular@"~13.2.3" from the root project npm ERR! npm ERR! Conflicting peer dependency: @angular/[email protected] npm ERR! node_modules/@angular/compiler npm ERR! peer @angular/compiler@"13.2.2" from @angular/[email protected] npm ERR! node_modules/@angular/compiler-cli npm ERR! dev @angular/compiler-cli@"~13.2.2" from the root project npm ERR! peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/[email protected] npm ERR! node_modules/@angular-devkit/build-angular npm ERR! dev @angular-devkit/build-angular@"~13.2.3" from the root project npm ERR! 2 more (@angular/localize, ng-packagr) 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.

--legacy-peer-deps didn't work and I'd rather not keep having to use --force. Why is this constantly broken?

bryantlikes avatar Feb 16 '22 01:02 bryantlikes

@bryantlikes I switched to using yarn using the following tutorial and was able to update without any issues. This is a know issue with npm: https://codinglatte.com/posts/angular/setup-angular-touse-yarn-package-manager/ This is not an issue with Angular. See the following issue: https://github.com/angular/angular-cli/issues/22565#issuecomment-1022568899

jayhamilton avatar Feb 16 '22 02:02 jayhamilton

I can look into that. I feel like there weren't any issues with this and Angular until the version numbers on the packages got out of sync. .Not sure what the point of that is but I preferred it when the numbers were in sync as it made it easier to make sure everything was the same version. Is there a reason they are different now?

bryantlikes avatar Feb 16 '22 15:02 bryantlikes

Try ng update @angular/cli @angular/core

hanyska avatar Feb 21 '22 10:02 hanyska

That is what I use

bryantlikes avatar Feb 21 '22 17:02 bryantlikes

If you switch to yarn and make it your default package manager, then ng update will work without an issue. https://codinglatte.com/posts/angular/setup-angular-touse-yarn-package-manager/

jayhamilton avatar Feb 22 '22 01:02 jayhamilton