我经常遇到 rxjs@5.0.0-beta.12 和 rxjs@5.0.0-beta.6 版本的问题。当我尝试安装新的npm库时,控制台会向我显示以下错误:
MacBook:angular2-seed$ npm install less
angular2-quickstart@1.0.0 /Volumes/Data/Proyectos/Paytime/angular2-seed
├─┬ less@2.7.1
│ ├─┬ errno@0.1.4
│ │ └── prr@0.0.0
│ ├── image-size@0.5.0
│ ├── mime@1.3.4
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ ├─┬ promise@7.1.1
│ │ └── asap@2.0.5
│ └── source-map@0.5.6
└── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.6
npm WARN @angular/core@2.0.1 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN angular2-quickstart@1.0.0 No description
npm WARN angular2-quickstart@1.0.0 No repository field.
然后,如果我更改了rxjs的版本,我会收到另一个错误:
MacBook:angular2-seed$ npm install
> angular2-quickstart@1.0.0 postinstall /Volumes/Data/Proyectos/Paytime/angular2-seed
> typings install
└── es6-shim (ambient)
angular2-quickstart@1.0.0 /Volumes/Data/Proyectos/Paytime/angular2-seed
└─┬ UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12
└── symbol-observable@1.0.2
npm WARN angular2@2.0.0-beta.17 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
npm WARN angular2-quickstart@1.0.0 No description
npm WARN angular2-quickstart@1.0.0 No repository field.
npm ERR! code 1
MacBook:angular2-seed$
我处在一个连续循环中,我不知道如何解决它,你能帮帮我吗?
我的package.json内容是:
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"typings": "typings",
"postinstall": "typings install"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.1",
"@angular/compiler": "2.0.1",
"@angular/core": "2.0.1",
"@angular/forms": "2.0.1",
"@angular/platform-browser": "2.0.1",
"angular2": "2.0.0-beta.17",
"es6-promise": "^3.0.2",
"es6-shim": "^0.35.0",
"ng2-bootstrap": "^1.1.1",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.22",
"zone.js": "0.6.21"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"typescript": "^2.0.2",
"typings": "^0.8.1"
}
}
答案 0 :(得分:4)
从"angular2": "2.0.0-beta.17"
删除dependencies
。这已经过时了,不再使用了。
Angular 2.0.x基本依赖关系如下:
"dependencies": {
"@angular/common": "~2.0.2",
"@angular/compiler": "~2.0.2",
"@angular/core": "~2.0.2",
"@angular/forms": "~2.0.2",
"@angular/http": "~2.0.2",
"@angular/platform-browser": "~2.0.2",
"@angular/platform-browser-dynamic": "~2.0.2",
"@angular/router": "~3.0.2",
"@angular/upgrade": "~2.0.2",
"angular-in-memory-web-api": "~0.1.5",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25"
},
参考:https://angular.io/guide/quickstart
如果您正在关注Angular 2快速入门示例,则可以从github repo中再次克隆它:https://github.com/angular/quickstart