3

Yesterday I upgraded Angular to 11.2.14. I updated Angular with the Angular guide and used to command ng update @angular/cdk@11 @angular/cli@11 @angular/core@11 @angular/material@11 After the command was executed it took a very long time to install the packages.

After 45minutes I canceled the ng update command and I wanted to try the install the packages manually with npm install. Unfortunately npm install wasn't working as I expected it to work.

npm install gives me the following error

npm ERR! While resolving: [email protected]        
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/cdk
npm ERR!   @angular/cdk@"^10.2.7" from the root project

When I try npm install @angular/cdk@11 I got the same error when I try npm install

I also get the same error on Angular material, core, common, compiler, and animations. I've tried different node versions, clear npm cache, delete node modules and delete the package-lock.json. None of those things seem to work.

The package.json Angular packages

"@angular/animations": "~11.2.14",
"@angular/cdk": "^10.2.7",
"@angular/common": "~11.2.14",
"@angular/compiler": "~11.2.14",
"@angular/core": "~11.2.14",
"@angular/fire": "^6.1.4",
"@angular/flex-layout": "^10.0.0-beta.32",
"@angular/forms": "~11.2.14",
"@angular/localize": "^11.2.14",
"@angular/material": "^11.2.13",
"@angular/platform-browser": "~11.2.14",
"@angular/platform-browser-dynamic": "~11.2.14",
"@angular/router": "~11.2.14",

Below is the output of ng --version. I know that the Angular CLI not at the same version is then Angular itself but even when Angular was 11.2.14 the errors still occure

Angular CLI: 11.2.14
Node: 14.17.1
OS: win32 x64

Angular: 12.0.5 (cli-only)
... common, core
Ivy Workspace: Yes

Package                             Version
-------------------------------------------------------------
@angular-devkit/architect           0.1102.14
@angular-devkit/build-angular       0.1102.14
@angular-devkit/core                11.2.14
@angular-devkit/schematics          11.2.14
@angular/animations                 <error>
@angular/cdk                        <error>
@angular/cli                        11.2.14
@angular/compiler                   <error>
@angular/compiler-cli               <error>
@angular/fire                       <error>
@angular/flex-layout                10.0.0-beta.32
@angular/forms                      11.2.14
@angular/language-service           11.2.14
@angular/localize                   11.2.14
@angular/material                   <error>
@angular/platform-browser           11.2.14
@angular/platform-browser-dynamic   11.2.14
@angular/router                     11.2.14
@schematics/angular                 11.2.14
@schematics/update                  0.1102.14
rxjs                                6.6.3 (cli-only)
typescript                          4.0.8

npm install --force or npm install --legacy-peers is not option because the packages wont be installed (and both commands are giving errors they can't find the Angular packges)

How can I resolve the error?

update I've created a new project and copy paste the dependecies in the new package.json. After the npm install I got the same error. I believe the error occurs on global scope and not just the project scope. I'm not sure how Angular gives undefined

ng --version global

Angular CLI: 12.0.5
Node: 14.17.1
Package Manager: npm 7.17.0
OS: win32 x64

Angular: undefined
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1200.5 (cli-only)
@angular-devkit/core         12.0.5 (cli-only)
@angular-devkit/schematics   12.0.5 (cli-only)
@schematics/angular          12.0.5 (cli-only)

update It looks like Angular is adding a extra ´´´""´´´. Where does the extra ´´´""´´´ come from?

5
  • can u tried ng update @angular/cdk or npm i @angular/[email protected] ?
    – naoval
    Jun 19, 2021 at 7:34
  • @naoval npm i @angular/[email protected] gives me the same error as npm i and ng update @angular/cdk gives me the error Package '@angular/cdk' is not a dependency.
    – J_P
    Jun 19, 2021 at 7:55
  • try removing node_modules and package-lock.json rm -rf node_modules package-lock.json then run npm i
    – naoval
    Jun 19, 2021 at 8:05
  • I would revert the change, and try it again, one after the other. Be aware that, as explained here changing your global angular cli version may help, explained in the answer how to do it . Jun 19, 2021 at 8:16
  • @naoval I already tried that. It gives me the same error as before.
    – J_P
    Jun 19, 2021 at 8:41

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.