Unable to install 'File' from ionic-native

Hi guys.

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": [] }

Your installation of Ionic and Ionic Native seem to be out of sync. It looks like you are using the new Ionic Native 3 installation command with the older Ionic Native.

Oh, I’ve just noticed this! The installed version of ‘file’ requires the 3.1.0 core. But honestly I didn’t even choose the ‘core’ to install so I wasn’t aware of that.

Can I still use the File API with ionic-native 2.4.1? I can’t find any documentation on that.

You are going to need to adjust your package.json file and run npm install to get the older Ionic Native core. The File API (aka File Plugin), will work in both systems, it is which Angular wrapper you are using to talk to it.

You may need to uninstall it before, clean cache en after install it again

Npm install --save @ionic-native/core

And after install File and other dependencies you may need