升级到Angular 9后缺少材料依存关系 [英] Missing material dependencies after upgrade to Angular 9

查看:59
本文介绍了升级到Angular 9后缺少材料依存关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了升级指南,将Angular从8.2迁移到9.1.我也在使用Angular材料,根据我也更新的指南.我还确保所有其他软件包均为通缉版本.<​​/p>

每当我尝试运行解决方案时,我都会得到:

目标入口点"@ angular/material/core"中的

  ERROR缺少相关性:-@角/核心-@角度/平台浏览器-rxjs-rxjs/运算符-@角度/平台浏览器/动画-@角度/普通-@角度/形式 

npm已过时,没有检查过的软件包.

所有Angular软件包都已通过ng update更新到了最新版本,只是为了确保我使用 npm cache clear --force 清除了缓存.

@ angular/core的版本位于"@ angular/core":"^ 9.1.11" ,材料位于"^ 9.2.4" .

我假设材料依赖于内核的不同版本,但不明白为什么要使用ng-cli默认安装它,以及如果安装不正确,则应安装哪个版本

解决方案

请按照以下步骤操作:-

  1. 删除node_modules文件夹.
  2. 删除package-lock.json文件.
  3. 运行 npm缓存清理--force
  4. 运行 npm install --save @ angular/material @ angular/cdk

然后尝试运行您的项目.

I followed the upgrade guide to migrate Angular from 8.2 to 9.1. I am also using Angular material which as per the guide I also updated. I also made sure all other packages are at Wanted version.

Whenever I try to run the solution I get:

ERROR in The target entry-point "@angular/material/core" has missing dependencies:
 - @angular/core
 - @angular/platform-browser
 - rxjs
 - rxjs/operators
 - @angular/platform-browser/animations
 - @angular/common
 - @angular/forms

There are no outdated packages as checked with npm outdated.

All angular packages have been updated to the latest with ng update and just to be sure I cleared the cache with npm cache clear --force.

The version of @angular/core is at "@angular/core": "^9.1.11" and material at "^9.2.4".

I am assuming material depends on a different version of core but don't understand why it would install it by default with ng-cli and what version to install if its not the right one

解决方案

Follow following steps :-

  1. Delete node_modules folder.
  2. Delete package-lock.json file.
  3. Run npm cache clean --force
  4. Run npm install --save @angular/material @angular/cdk

Then try to run your project.

这篇关于升级到Angular 9后缺少材料依存关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆