Ionic state restore alternative

#1

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

#2

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

#3
$ 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
#4

So you are using Capacitor and not Cordova?

1 Like
#5

Yeah,
I’m using Capacitor.

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

#6

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
#7

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

#8

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

#9

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.