Node.js and the CLI

Node.js, npm and the Capacitor CLI

The Capacitor 243,123 CLI is a Node.js 2,131 program that declares its floor in the engines field. An Android app needs three packages: @capacitor/core (the JavaScript runtime), @capacitor/android (the native library) and @capacitor/cli (the cap command), the last as a dev dependency because only the build machine runs it:

Checking Node.js and installing Capacitor 8 into an empty projectShell
node --version
npm view @capacitor/cli engines
mkdir booknest-cap && cd booknest-cap
npm init -y > /dev/null
npm install @capacitor/core @capacitor/android
npm install -D @capacitor/cli
npx cap --version
Output
v22.22.1
{ node: '>=22.0.0' }
added 3 packages, and audited 4 packages in 27s
...
added 95 packages, and audited 99 packages in 3s
...
8.5.2

If Node is older than 22, upgrade it, for example with nvm 95,199 (https://github.com/nvm-sh/nvm 95,199 ) (MIT; nvm install 22), which can keep Node 20 for older projects. The runtime side is three packages, counting @capacitor/core's one dependency, tslib; the CLI brings 95 for its prompts, templates and project tooling.