在我的Ionic 2项目中,我尝试使用npm install ng2-pdf-viewer --save
导致: ├──UNMETPEER DEPENDENCY @ angular / core @ 2.1.1
└─┬ng2-pdf-viewer@1.0.1
└──@ types / pdf @ 0.0.31
npm WARN ng2-pdf-viewer@1.0.1需要@ angular / core @ ^ 2.2.1的同伴 但没有安装。
我该如何解决这个问题?
我的package.json包括:
"dependencies": {
"@angular/common": "2.1.1",
"@angular/compiler": "2.1.1",
"@angular/compiler-cli": "2.1.1",
"@angular/core": "2.1.1",
"@angular/forms": "2.1.1",
"@angular/http": "2.1.1",
"@angular/platform-browser": "2.1.1",
"@angular/platform-browser-dynamic": "2.1.1",
"@angular/platform-server": "2.1.1",
"@ionic/storage": "1.1.6",
"@types/moment": "^2.13.0",
"font-awesome": "^4.7.0",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"jquery": "^3.1.1",
"moment": "^2.17.1",
"ng2-pdf-viewer": "^1.0.1",
"pdfjs-dist": "^1.6.483",
"rxjs": "5.0.0-beta.12",
"ts-md5": "^1.2.0",
"zone.js": "0.6.26"
}
答案 0 :(得分:1)
要使用ng2-pdf-viewer
,您需要angular 2.2.1
或更多。
您可能必须将package.json中的所有角度依赖关系[angular / core,http,compiler-cli等]更新为2.2.1^
并检查。
您可以参考最新的离子2包依赖项here。