我需要将我的角度升级到rc5才能使用NgModule。
我已关注directions from Angular 2。
我已将package.json依赖项更新为此,然后在终端中运行npm stall:
"dependencies": {
"@angular/common": "^2.0.0-rc.5",
"@angular/compiler": "^2.0.0-rc.5",
"@angular/core": "^2.0.0-rc.5",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "^2.0.0-rc.5",
"@angular/platform-browser-dynamic": "^2.0.0-rc.5",
"@angular/router": "3.0.0-beta.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.5",
"angular2-google-maps": "^0.12.0",
"angular2-in-memory-web-api": "0.0.14",
"bootstrap": "^3.3.6",
"core-js": "^2.4.0",
"jquery": "v3.1.0",
"ng2-select": "^1.0.3",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"zone.js": "^0.6.12"
},
终端结果:
Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install
> the-vegan-repository@1.0.0 postinstall /Users/Ben/Development/the-vegan-repository
> typings install
typings WARN deprecated 7/26/2016: "registry:dt/core-js#0.0.0+20160602141332" is deprecated (updated, replaced or removed)
typings WARN deprecated 8/7/2016: "registry:dt/node#6.0.0+20160621231320" is deprecated (updated, replaced or removed)
├── core-js (global)
├── jasmine (global)
└── node (global)
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/core@2.0.0-rc.4 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/http@2.0.0-rc.4 but none was installed.
npm WARN EPACKAGEJSON the-vegan-repository@1.0.0 No repository field.
我尝试过Angular 2建议的其他选项:
npm install @angular/{core,common,compiler,platform-browser,platform-browser-dynamic} --save
结果:
Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install @angular/{core,common,compiler,platform-browser,platform-browser-dynamic} --save
the-vegan-repository@1.0.0 /Users/Ben/Development/the-vegan-repository
├── UNMET PEER DEPENDENCY @angular/common@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/http@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@2.0.0-rc.5
└── UNMET PEER DEPENDENCY es6-shim@^0.35.0
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/core@2.0.0-rc.4 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/http@2.0.0-rc.4 but none was installed.
npm WARN EPACKAGEJSON the-vegan-repository@1.0.0 No repository field.
npm ERR! code 1
无论我做什么升级,我都会得到相同的未满足的对等依赖项错误。
要解决我尝试过的问题:
npm install @angular
结果:
Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install @angular
npm ERR! addLocal Could not install /Users/Ben/Development/the-vegan-repository/@angular
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "@angular"
npm ERR! node v5.3.0
npm ERR! npm v3.3.12
npm ERR! path /Users/Ben/Development/the-vegan-repository/@angular
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/Ben/Development/the-vegan-repository/@angular'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Ben/Development/the-vegan-repository/npm-debug.log
npm install @ angular / common
结果:
Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install @angular/common
the-vegan-repository@1.0.0 /Users/Ben/Development/the-vegan-repository
├── UNMET PEER DEPENDENCY @angular/common@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/http@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@2.0.0-rc.5
└── UNMET PEER DEPENDENCY es6-shim@^0.35.0
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/core@2.0.0-rc.4 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/http@2.0.0-rc.4 but none was installed.
npm WARN EPACKAGEJSON the-vegan-repository@1.0.0 No repository field.
npm ERR! code 1
npm install @ angular / common @ 2.0.0-rc.5
结果:
Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install @angular/common@2.0.0-rc.5
the-vegan-repository@1.0.0 /Users/Ben/Development/the-vegan-repository
├── UNMET PEER DEPENDENCY @angular/common@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/http@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@2.0.0-rc.5
└── UNMET PEER DEPENDENCY es6-shim@^0.35.0
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/core@2.0.0-rc.4 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/http@2.0.0-rc.4 but none was installed.
npm WARN EPACKAGEJSON the-vegan-repository@1.0.0 No repository field.
npm ERR! code 1
请注意,这是一个有效的角度2应用程序,所以我似乎安装了角度2。如何满足我的对等依赖项,以便我可以升级到angular2 rc5?
答案 0 :(得分:3)
您是否尝试过新的npm install
?绝对会推荐。还要尝试事先清理缓存,以确保之前没有冲突:
rm -rf node_modules/
npm cache clean
npm install
另外,我建议您将路由器更新为3.0.0-rc.1
。这是最新的版本。
编辑:我还建议您删除node_modules
目录,然后通过安装rm -rf node_modules
获取新目录。
答案 1 :(得分:2)
您收到此错误的原因是因为您使用"angular2-google-maps": "^0.12.0"
和angular2。现在"angular2-google-maps"
依赖于angular 2.0.0-rc.2
版本,这是错误所声明的内容:
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
这仍然是一个未解决的问题here。
angular 2.0.0-rc.2
直到它
解决。 npm i https://github.com/SebastianM/angular2-google-maps/tarball/0.12.0 --save
安装google-maps。编辑:他们正在发布0.13.0
版本,该版本将在几天内与rc5
兼容。有关详情,请查看here
答案 2 :(得分:0)
如果您仍有问题,请尝试
npm --depth Infinity update
答案 3 :(得分:0)
这也是我面临的同样问题 -
我只是更新npm -
sudo npm install npm -g
我的问题得到解决!!!