Ionic version for adding file

Hello everyone,

I am doing an app on ionic, and I want to allow people to add image into my app…
So i am following tutorial, this one at the moment :

My ionic info says :

Ionic:

   Ionic CLI          : 5.2.4 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : not installed

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (0 plugins total)

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.15.0 (/usr/local/bin/node)
   npm    : 6.9.0
   OS     : macOS Mojave```


And my package.json :

"dependencies": {
    "@angular/animations": "^5.2.11",
    "@angular/cdk": "^5.2.4",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "^7.2.6",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/material": "^5.2.4",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/camera": "^4.20.0",
    "@ionic-native/core": "~4.18.0",
    "@ionic-native/file": "^5.11.0",
    "@ionic-native/file-chooser": "^3.14.0",
    "@ionic-native/file-path": "^5.11.0",
    "@ionic-native/file-transfer": "^5.14.0",
    "@ionic-native/splash-screen": "~4.18.0",
    "@ionic-native/status-bar": "~4.18.0",
    "@ionic-native/video-player": "^5.8.0",
    "@ionic/storage": "2.2.0",
    "angularfire2": "^5.1.1",
    "cordova-browser": "5.0.4",
    "cordova-plugin-camera": "4.0.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-filechooser": "^1.2.0",
    "cordova-plugin-filepath": "^1.5.6",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^3.1.2",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "firebase": "^5.8.3",
    "hammerjs": "^2.0.8",
    "ionic-angular": "3.9.2",
    "ionic-img-viewer": "^2.9.0",
    "ionic-native": "^2.9.0",
    "ionicons": "3.0.0",
    "react-native-gesture-handler": "^1.0.16",
    "react-navigation": "^3.3.0",
    "rxjs": "^5.5.11",
    "save": "^2.3.3",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.2",
    "@ionic/lab": "1.0.20",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-camera": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-file": {},
      "cordova-plugin-filepath": {},
      "cordova-plugin-filechooser": {},
      "cordova-plugin-file-transfer": {}
    },
    "platforms": [
      "browser"
    ]```

When I declare into my providers in my app.module.ts, all the code of this page ( app.module.ts) is highlighted in red and I have this message :

Is it a version issue? If yes what is wrong with what I am doing?

I would really appreciate any help my ionic friends :smiley:

Yes, and “mixing major versions of @ionic-native things”. Align them all to 5.x.

Alright, thanks :smiley:
So if I get what you are saying:
My problems come from my ionic native versions.

And how do I align them to 5.x ?

I tried to change my package.json with all the ionic native things to 5.14.0 and sudo npm i
But I have only errors on my command line :

Above those errors are some more errors that I can’t understand like :
configure error
stack error EACCESS permission denied
System Darwin

Build failed with error code:1

I don’t know what to do next…

Thanks

Somebody may come along with a less-drastic answer, and feel free to wait for that. That being said,

  1. Completely reinstall your OS. Buy a new computer if necessary.

OK, I’m exaggerating here, but not by much. UNIX is designed with the assumption that the superuser knows what they are doing. Whenever you run anything under sudo, you become that superuser. So, it is essential that you know exactly what any command executed under sudo is doing, especially when it comes to modifying filesystem things. The good news: there is absolutely no need to run npm (or any other Ionic-app-building commands) as root. The bad news: once you’ve done it even once, you have bollixed up a bunch of permissions on things in possibly far-flung places that are hard to locate. So, actually:

  1. Move the code you’ve written already somewhere safe for later use.
  2. Install nvm and use it to manage all your node.js stuff.
  3. Create a brand-new project from scratch.
  4. Parachute the code you saved in step 1 into your new project.

As long as you never run anything npm-related under sudo, all of your EACCES problems should not recur.

More good news: you basically were on the right track with editing package.json and running npm i (but no sudo any more). Anything else in your post that wasn’t in text form, I can’t address.