Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@capacitor/cli

Package Overview
Dependencies
Maintainers
17
Versions
1140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor/cli

Capacitor: Cross-platform apps with JavaScript and the web

Source
npmnpm
Version
8.0.0-alpha.1
Version published
Weekly downloads
770K
6.27%
Maintainers
17
Weekly downloads
 
Created
Source

Capacitor CLI

The Capacitor command-line interface (CLI) is a tool for creating and managing Capacitor applications. While it can be installed globally, it's recommended to install it locally in your project and execute through npm scripts.

Installation

Install the CLI locally in your project:

npm install @capacitor/cli --save-dev

Global Installation

While not recommended for project use, you can install the CLI globally:

npm install -g @capacitor/cli

Using Capacitor CLI

The CLI can be used through the capacitor or cap command. When installed locally, use it through your project's npm scripts or npx.

Common commands:

  • cap init: Initialize a new Capacitor project
  • cap add: Add a native platform (ios, android)
  • cap sync: Sync your web code to your native projects

For detailed information, consult the Getting Started guide.

Local Development

If you're contributing to the Capacitor CLI or testing local changes:

  • Clone and setup:

    git clone https://github.com/ionic-team/capacitor.git
    cd cli
    npm install
    
  • Build the CLI:

    npm run build
    
  • Create a local link:

    npm link
    
  • Development workflow:

    • Run npm run watch to automatically rebuild on changes
    • Use capacitor or cap commands to test your changes
    • Run npm test to execute the test suite

Debugging

Using VS Code Launch Configurations

The CLI includes VS Code launch configurations for debugging. To debug a CLI command:

  • Open the project in VS Code
  • Right now we don't have debugging working in the ts files, so select one of the .js files inside of /dist/**.js
  • Place a breakpoint
  • Press F5 or go to Run > Start Debugging
  • Select a launch config and run filling out the path you want to run the cli in, and the command that you want run.

You can add more configurations by copying and modifying the existing ones in .vscode/launch.json.

Contributing

Contributions are welcome! Please read our Contributing Guide for details.

License

Keywords

ionic

FAQs

Package last updated on 20 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts