Ionic state restore alternative

I am using ionic 4.

After I clone an ionic 4 project, I want to add all of the cordova plugins from package.json.
**Note “npm install” does not add the plugins automatically.

At the moment I have to manually run these commands:

ionic cordova plugin add cordova-plugin-inappbrowser@latest

If you rm/add the platform, iOS or Android, it will fetch the plugins

$ ionic capacitor <command>

add ............................. (beta) Add a native platform to your Ionic project
copy ............................ (beta) Copy web assets to native platforms
open ............................ (beta) Open the IDE for a given native platform project
run ............................. (beta) Run an Ionic project on a connected device
sync ............................ (beta) Sync (copy + update) an Ionic project
update .......................... (beta) Update Capacitor native platforms, install Capacitor/Cordova plugins

So you are using Capacitor and not Cordova?

1 Like

Yeah,
I’m using Capacitor.

There is no way to remove platform, then add it again.

Yeah, @reedrichards 's advice was based on the assumption that you are using Cordova.

My Capacitor knowledge is wonky as well, but shouldn’t your native project be part of your version control / git and thus already include the plugins?

1 Like

that’s what I thought too… but when I clone the project to another machine. The error said plugins not found!

What error when running which command? You haven’t mentioned those yet.

when use this command

ionic capacitor run android

In the android-studio project when compiling this error occurs:

C:\Users\Wallst\Documents\ionic4_starter\android\capacitor-cordova-android-plugins\cordova.variables.gradle (The system cannot find the path specified)

unless I remove and reinstall all of the plugins.