Reputation: 111
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:
`[email protected] D:\project\
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @ionic-native/core@^3.1.0
+-- @ionic-native/[email protected]
-- UNMET PEER DEPENDENCY [email protected]`
`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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @ionic-native/[email protected] requires a peer of @ionic-native/core@^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.`
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": []
}
`
Upvotes: 2
Views: 3149
Reputation: 830
Install all dependencies again
npm install
and
npm install --save @ionic-native/core
Upvotes: 0
Reputation: 111
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.
Upvotes: 8
Reputation: 129
I tried to install it in brand new project and npm also complained about @ionic-native/core missing. In fact, you should try to install it (and other dependencies) separately before installing @ionic-native/file.
Hope it helps!
Upvotes: 0