Capacitor is easily installed directly into any Ionic project (1.0-4.x+).
ionic start myApp tabs --capacitor cd myApp
cd myApp ionic integrations enable capacitor
npx is a new utility available in npm 5 or above that executes local binaries/scripts to avoid global installs.
npx cap init [appName] [appId]
appName is the name of your app, and
appId is the domain identifier of your app (ex:
Note: Use the native IDEs to change these properties after initial configuration.
You must build your Ionic project at least once before adding any native platforms.
This creates the
www folder that Capacitor has been
automatically configured to use as the
npx cap add ios npx cap add android
ios folders at the root of the project are created. These are entirely separate native project artifacts that should be considered part of your Ionic app (i.e., check them into source control, edit them in their own IDEs, etc.).
npx cap open ios npx cap open android
The native iOS and Android projects are opened in their standard IDEs (Xcode and Android Studio, respectively). Use the IDEs to run and deploy your app.
Every time you perform a build (e.g.
ionic build) that changes your web directory (default:
www), you’ll need to copy those changes down to your native projects:
npx cap copy
Want to start using Capacitor in an Ionic app immediately? Check out this guide.