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

Got similar dependency error while upgrading to Angular 13 from 12, solved by using npm v6, and re-running ng update:

npm i -g npm@6

(I was previously on Node v12 and npm v8.)

You may run into following error during the process depending on the state of your repo:

Package '@angular/core' is not a dependency.

Solution: run npm i, commit your change, then re-run your ng update command.

manu2504 avatar Feb 27 '22 06:02 manu2504

npm i -g npm@6

This worked for me to go from 13.1.x to 13.2.x. Thank you

RogierVC avatar Feb 28 '22 10:02 RogierVC

Ok, I was also able to upgrade from 13.1.x to 13.2.x after switching to npm@6.

So is this an angular issue or an NPM issue? There has to be a lot of angular developers using npm > 6.

bryantlikes avatar Mar 01 '22 16:03 bryantlikes

I guess this line from the packages.json says it all.

  "//engines-comment": "Keep this in sync with /aio/package.json and /aio/tools/examples/shared/package.json",
  "engines": {
    "node": "^12.20.0 || ^14.15.0 || >=16.10.0",
    "yarn": ">=1.22.4 <2",
    "npm": "**Please use yarn instead of NPM to install dependencies"**
  },

bryantlikes avatar Mar 01 '22 16:03 bryantlikes

Same issue on my side with [email protected].

Trying to upgrade from angular 13.1.2 to 13.2.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.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~13.2.5" 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.4" from @angular/[email protected]
npm ERR!   node_modules/@angular/compiler-cli
npm ERR!     dev @angular/compiler-cli@"~13.2.4" 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.5" 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.

dylanvdmerwe avatar Mar 01 '22 18:03 dylanvdmerwe

@dylanvdmerwe seems the solution is to either install npm@6 or switch to yarn.

bryantlikes avatar Mar 01 '22 18:03 bryantlikes

same issue here

npm 8.1.2
node v16.13.1

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.1.0
Node: 16.13.1
Package Manager: npm 8.1.2
OS: darwin 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)

CREATE my-workspace/README.md (1057 bytes)
CREATE my-workspace/.editorconfig (274 bytes)
CREATE my-workspace/.gitignore (620 bytes)
CREATE my-workspace/angular.json (139 bytes)
CREATE my-workspace/package.json (1028 bytes)
CREATE my-workspace/tsconfig.json (863 bytes)
CREATE my-workspace/.vscode/extensions.json (130 bytes)
CREATE my-workspace/.vscode/launch.json (474 bytes)
CREATE my-workspace/.vscode/tasks.json (938 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!
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!
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/drorrash/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/drorrash/.npm/_logs/2022-03-11T09_07_33_595Z-debug.log
✖ Package install failed, see above.
The Schematic workflow failed. See above.
-----------------------------------------------------------------------------

iamdror avatar Mar 11 '22 09:03 iamdror

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.