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 the "npm install" command, run the 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 the list of installed packages 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 the config changed

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
        )

      

+3


source to share


1 answer


The package @angular/material

requires angular 2, so it is incompatible with angular 4. As per npm semantic versioning rule , ^2.3.0

only allows version greater than or equal to 2.3.0

, but still with major version 2, so only 2.x.y

where x >= 3

.



You will have to wait until they release a version for angular 4. When the failed request # 3752 is merged, you can use the master branch as described in the Readme - Installation . Otherwise, you need to wait until they publish it before npm.

+2


source







All Articles