Vignesh
Vignesh

Reputation: 2386

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/[email protected]
    npm ERR! peer dep missing: @angular/common@^2.0.0, required by [email protected]
    npm ERR! peer dep missing: @angular/core@^2.3.0, required by @angular/[email protected]
    npm ERR! peer dep missing: @angular/core@^2.0.0, required by [email protected]

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
        )

Upvotes: 3

Views: 864

Answers (1)

Michael Jungo
Michael Jungo

Reputation: 32972

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.

Upvotes: 2

Related Questions