← 返回命令列表

Linux command

capacitor 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Initialize Capacitor

npx cap init [appName] [appId]

Add a platform

npx cap add [android|ios]

Sync web assets

npx cap sync

Sync a specific platform

npx cap sync [android|ios]

Copy web assets

npx cap copy

Open the native IDE

npx cap open [android|ios]

Build and run

npx cap run [android|ios]

Check system configuration

npx cap doctor

说明

Capacitor is an open-source native runtime by Ionic for building cross-platform mobile applications using web technologies (JavaScript, HTML, CSS). It allows web developers to create native iOS, Android, and Progressive Web Apps from a single codebase. The Capacitor CLI manages the native project lifecycle including initialization, platform management, asset synchronization, and building. Unlike Cordova, Capacitor embraces native project configuration, giving developers direct access to native IDEs and build systems. Web assets are built separately (using any web framework) and then copied to native projects with cap sync. Native functionality is accessed through Capacitor plugins that bridge JavaScript to native iOS/Android APIs.

参数

-V, --version
Display version number.
-h, --help
Show usage information. Works with individual commands.

FAQ

What is the capacitor command used for?

Capacitor is an open-source native runtime by Ionic for building cross-platform mobile applications using web technologies (JavaScript, HTML, CSS). It allows web developers to create native iOS, Android, and Progressive Web Apps from a single codebase. The Capacitor CLI manages the native project lifecycle including initialization, platform management, asset synchronization, and building. Unlike Cordova, Capacitor embraces native project configuration, giving developers direct access to native IDEs and build systems. Web assets are built separately (using any web framework) and then copied to native projects with cap sync. Native functionality is accessed through Capacitor plugins that bridge JavaScript to native iOS/Android APIs.

How do I run a basic capacitor example?

Run `npx cap init [appName] [appId]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -V, --version do in capacitor?

Display version number.