Issue
So I'm pretty fresh in Ionic2 so I'm getting some newbie troubles =/ I've searched pretty much everything and I can't find any examples for this.
What I want to do is to write a file to a certain directory of the device. I'm using Ionic2 and I've seen that there's a 'File API' that does what I need. But the problem is that I can't set it up.
Whenever I do $ npm install --save @ionic-native/file I get this output:
`project@0.0.1 D:\project\
+-- UNMET PEER DEPENDENCY @angular/core@2.2.1
+-- UNMET PEER DEPENDENCY @ionic-native/core@^3.1.0
+-- @ionic-native/file@3.2.1
-- UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12`
`npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @ionic-native/file@3.2.1 requires a peer of @ionic-native/core@^3.1.0 but none was installed.
npm WARN @ionic-native/file@3.2.1 requires a peer of @angular/core@2.4.8 but none was installed.
npm WARN @ionic-native/file@3.2.1 requires a peer of rxjs@5.0.1 but none was installed.`
But whenever I try to use npm install for these missing dependencies, it keeps giving me the same errors over and over again. I'm quite lost here. I've tried to delete node_modules, cache clean and install and I still can't get the File to work.
If you could assist me here that would be great. I can provide other info if needed. Cheers!
--------- Here are my dependencies from 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": []
}
`
Solution
I've fixed this problem.
1: Remove node_modules, clean cache and install all dependencies again
rm -rf node_modules
npm cache clean
npm install
2: In my problem, I needed ionic-native@core to be 3.1.0 or higher to be able to use ionic-native@file. So I run
npm install --save @ionic-native/core
And it got fixed.
Answered By - hedz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.