角度v 4.0.0中的对等依赖性警告

时间:2017-03-24 10:26:38

标签: node.js angular webpack-2 typescript2.1

我已将角度包版本从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
        )

1 个答案:

答案 0 :(得分:2)

@angular/material包需要角度2,因此它与角度4不兼容。semantic versioning rules of npm ^2.3.0只允许版本大于或等于2.3.0但仍然主要版本2,只有2.x.y x >= 3

您必须等到他们为Angular 4发布版本。当合并拉取请求#3752时,您可以使用Readme - Installation中所述的主分支。否则你需要等到他们把它发布到npm。