我是所有angular-cli
项目创建方法的新手,但它似乎很酷,可以继续测试。
所以我用ng new tuxin-skeleton-angular2-frontend
它使用以下内容创建了package.json:
{
"name": "tuxin-skeleton-angular2-frontend",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "~2.0.0",
"@angular/compiler": "~2.0.0",
"@angular/core": "~2.0.0",
"@angular/forms": "~2.0.0",
"@angular/http": "~2.0.0",
"@angular/platform-browser": "~2.0.0",
"@angular/platform-browser-dynamic": "~2.0.0",
"@angular/router": "~3.0.0",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/jasmine": "^2.2.30",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.17",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
}
}
到目前为止一直很好......
只是为了它的乐趣,我运行npm update --save
但它没有真正更新任何内容,因为它包含特定版本或~
的使用。
好..现在我要安装@angular/material
。所以我只需输入npm install --save @angular/material
即可获得以下输出:
tuxin-skeleton-angular2-frontend@0.0.0 /Users/ufk/Projects/tuxin-skeleton/tuxin-skeleton-angular2-frontend
├── UNMET PEER DEPENDENCY @angular/common@2.0.2
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.2
├── UNMET PEER DEPENDENCY @angular/core@2.0.2
├─┬ @angular/material@2.0.0-alpha.9-3
│ └── @types/hammerjs@2.0.33
└── UNMET PEER DEPENDENCY @angular/platform-browser@2.0.2
npm WARN @angular/compiler-cli@0.6.4 requires a peer of @angular/platform-server@2.0.2 but none was installed.
npm WARN @angular/platform-server@2.1.0 requires a peer of @angular/core@2.1.0 but none was installed.
npm WARN @angular/platform-server@2.1.0 requires a peer of @angular/common@2.1.0 but none was installed.
npm WARN @angular/platform-server@2.1.0 requires a peer of @angular/compiler@2.1.0 but none was installed.
npm WARN @angular/platform-server@2.1.0 requires a peer of @angular/platform-browser@2.1.0 but none was installed.
所以我们在这里学到了什么......
@angular/compiler-cli@0.6.4
需要@angular/platform-server@2.0.2
,现在我安装了2.1.0版。
@angular/platform-server@2.1.0
需要@angular/{core,common,compiler,platform-browser}@2.1.0
。
所以...一般来说我有几个问题......
为什么angular-cli安装了角度2.0.0而2.1.0已经安装了?有没有办法指定要安装的版本?谁决定应该安装什么版本?
有没有办法在我尝试安装@angular/material
时,让它安装与我当前的package.json兼容的版本而不是最新版本?
是的..我可以在package.json中手动修改每个软件包版本,这是要走的路吗?
因为我是angular-cli
的新手,我有点失去了使用哪种方法继续前进..我应该手动修补package.json吗?我应该通过角度2.0.2将@angular/material
降级到支持的版本吗?我会走一个完全不同的方向吗?也许angular-cli
不是我的一杯茶?
非常感谢有关该问题的任何信息。
感谢