角度v 4.0.0中的对等依赖性警告(Peer Dependency warning in angular v 4.0.0)

编程入门 行业动态 更新时间:2024-10-27 22:33:38
角度v 4.0.0中的对等依赖性警告(Peer Dependency warning in angular v 4.0.0)

我已将角度包版本从2.4.10更新到4.0.0。 运行'npm install'命令后,它会抛出以下消息

npm ERR! peer dep missing: @angular/common@^2.3.0, required by @angular/material@2.0.0-beta.2 npm ERR! peer dep missing: @angular/common@^2.0.0, required by angular2-flex@1.0.3 npm ERR! peer dep missing: @angular/core@^2.3.0, required by @angular/material@2.0.0-beta.2 npm ERR! peer dep missing: @angular/core@^2.0.0, required by angular2-flex@1.0.3

我的已安装包列表如下

"dependencies": { "@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/core": "^4.0.0", "@angular/forms": "^4.0.0", "@angular/http": "^4.0.0", "@angular/material": "^2.0.0-beta.2", "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/router": "^4.0.0", "angular2-moment": "^1.3.0", "angular2-recaptcha": "^0.4.0", "angular2-flex": "^1.0.3" }

并在webpack.common.js中更改了配置

new webpack.ContextReplacementPlugin( // The (\\|\/) piece accounts for path separators in *nix and Windows /angular(\\|\/)core(\\|\/)@angular/, helpers.root('./src'),// location of your src {} // a map of your routes )

I have updated the angular packages version from 2.4.10 to 4.0.0. After running 'npm install' command it throw's following message

npm ERR! peer dep missing: @angular/common@^2.3.0, required by @angular/material@2.0.0-beta.2 npm ERR! peer dep missing: @angular/common@^2.0.0, required by angular2-flex@1.0.3 npm ERR! peer dep missing: @angular/core@^2.3.0, required by @angular/material@2.0.0-beta.2 npm ERR! peer dep missing: @angular/core@^2.0.0, required by angular2-flex@1.0.3

And my installed packages list is below

"dependencies": { "@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/core": "^4.0.0", "@angular/forms": "^4.0.0", "@angular/http": "^4.0.0", "@angular/material": "^2.0.0-beta.2", "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/router": "^4.0.0", "angular2-moment": "^1.3.0", "angular2-recaptcha": "^0.4.0", "angular2-flex": "^1.0.3" }

And in webpack.common.js changed the configuration

new webpack.ContextReplacementPlugin( // The (\\|\/) piece accounts for path separators in *nix and Windows /angular(\\|\/)core(\\|\/)@angular/, helpers.root('./src'),// location of your src {} // a map of your routes )

最满意答案

@angular/material包需要angular 2,因此它与angular 4不兼容。通过npm的语义版本控制规则 , ^2.3.0只允许大于或等于2.3.0的版本但仍然使用主版本2,所以只有2.xy ,其中x >= 3 。

您必须等到他们为Angular 4发布版本。当合并拉取请求#3752时 ,您可以使用自述分支- 自述文件 - 安装中所述 。 否则你需要等到他们将它发布到npm。

The @angular/material package requires angular 2, so it's not compatible with angular 4. By the semantic versioning rules of npm, ^2.3.0 allows only version greater than or equal to 2.3.0 but still with the major version 2, so only 2.x.y where x >= 3.

You'll have to wait until they release a version for Angular 4. When the pull request #3752 is merged, you could use the master branch as described in Readme - Installation. Otherwise you need to wait until they publish it to npm.

更多推荐

本文发布于:2023-08-01 15:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1359298.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对等   依赖性   角度   angular   warning

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!