[ionic 4] How to remove Capacitor from app?

I added @capacitor to my ionic 4 app and now I want to remove it and just focus on ionic-native.

How can I remove @capacitor?

Could you copy your own code into a new solution?

I wish there was an easier option… Would something like this work?

npm uninstall --save @capacitor/cli @capacitor/core
2 Likes

Hello,

as far as I know. Yes.

By the way. Do you have problems with capacitor? Maybe you need to add /ngx to your import path to use ionic native on capacitor.

Best regards, anna-liebt

Hello Anna, I don’t have problems with capacitor but I don’t see all the plugins I need in capacitor yet. So I’ll stick with ionic-native for now for my ionic4 app.

hello,
yes capacitor is on beta, also the docs are not really good.
If you wanna stay a capacitor and will use native plugins, then you have to install ionic native plugins with Version 5.x.xbeta. Take a look to your package.json you have with capacitor something like

"@ionic-native/splash-screen": "5.0.0-beta.21",

If you install, like in ionic native plugin described, then you must change after installation the ionic-native version to 5.0.0-beta.21. If you use visual code, then there are extension that helps to find beta versions. You can change the version by hand and run after saving npm i.

To use the native plugin from code side in ts you need to add to the import path /ngx
like

import { Whatever} from '@ionic-native/whatever/ngx';

This should run most plugins, but yes capacitor is beta.

Best regrads, anna-liebt

1 Like

another one is:

npm uninstall --save @capacitor/android

1 Like

I cant remove the capacitor with the above commands

You will have to remove the package from package.json and also remove it from node_modules using npm uninstall <packageName>

In case the package has already been copied to platforms, you will have to “undo” all the steps you did when attaching those packages/plugins to the platforms.

You need to do below steps and for sure you can uninstall

  1. Delete node_modules & package
  2. remove platform
  3. from ionic.config.json remove capacitor
  4. delete package-lock.json
  5. remove capacitor(core & cli) from package.json
  6. npm install & add platform
  7. done
6 Likes

it work for me thanks

working
its working i face same issue now its resolve

you can run ionic integrations disable capacitor inside a capacitor project to disable capacitor and install Cordova using ionic Cordova platform add android, it will be asked from conformation just hit y to confirm that and you good to go with Cordova project.