所以我在Ionic2中很新鮮,所以我得到了一些新手麻煩= /我搜索了幾乎所有的東西,我找不到任何這樣的例子。無法安裝來自ionic-native的'文件' - 相關性依賴關係?
我想要做的是寫一個文件到設備的某個目錄。我使用的是Ionic2,我看到有一個'File API'可以滿足我的需求。但問題是我無法設置它。
每當我做$ npm install --save @ionic-native/file
我得到這樣的輸出:
`[email protected] D:\project\
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @ionic-native/[email protected]^3.1.0
+-- @ionic-native/[email protected]
-- UNMET PEER DEPENDENCY [email protected]`
`npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @ionic-native/[email protected] requires a peer of @ionic-native/[email protected]^3.1.0 but none was installed.
npm WARN @ionic-native/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @ionic-native/[email protected] requires a peer of [email protected] but none was installed.`
但每當我嘗試使用NPM安裝這些缺少的依賴關係,它保持了一遍又一遍給我同樣的錯誤。我很迷茫。我試圖刪除node_modules,緩存清理和安裝,我仍然無法讓文件工作。
如果你能在這裏幫助我,這將是偉大的。如果需要,我可以提供其他信息。乾杯!
---------以下是的package.json我依賴
`
{
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic-native/file": "^3.2.1",
"@ionic/storage": "1.1.7",
"@ngx-translate/core": "^6.0.0",
"@ngx-translate/http-loader": "0.0.3",
"cordova": "^6.5.0",
"ionic-angular": "2.0.1",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"jquery": "^3.1.1",
"rxjs": "5.0.0-beta.12",
"sw-toolbox": "3.4.0",
"xml2json": "^0.11.0",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "1.1.0",
"@types/jquery": "^2.0.41",
"jscs": "^3.0.7",
"typescript": "2.0.9"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-device",
"cordova-plugin-statusbar",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": []
}
`
我試圖安裝未滿足PEER的角度,本地和rxjs但它一直在抱怨=/ – hedz
而且做得成功安裝?嘗試在項目目錄中用'npm ls'來檢查。您也可以嘗試以其他順序安裝缺少的對等方 – Nevaan
好消息,我剛解決了這個問題。看起來像我安裝的「文件」版本要求ion-native @ core版本爲3.1.0或更高版本。 – hedz