我已将角度包版本从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.3And 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.
更多推荐
发布评论