简体   繁体   中英

Peer Dependency warning in angular v 4.0.0

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
        )

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.xy 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM