Capacitor file download4/13/2023 ![]() If you start without an existing web app project, you can use npx to temporarily download and install and use its create command to generate a whole Capacitor project with a rudimentary web app included (that has installed). Npm install you can use the init command from above to initialize a Capacitor configuration file,, in your existing project. If you already have a web app with a package.json file, for example one built with Ionic, you start by installing the CLI and the Core library locally with npm: ![]() To create your Capacitor project you have two options: a) npx cap init The first two Capacitor commands use these options: 1. Even if you upgrade one Capacitor project, you can easily still use an older version in another project. Npx on the other hand enables you to a) run a local package from the project you are working on or b) run a package that is not (yet) installed in your project or even outside of a project context alltogether.īesides being pretty handy, this also means that each Capacitor project can have its own version of the CLI locally installed in the project. Then cordova or ionic becomes available globally in your command line. If you used Cordova or Ionic before, you know that the first step before being able to create a project with them is always to create a global installation of their CLI tool by running npm install -g cordova or npm i -g ionic. ![]() The cap in npx cap obviously stands for “Capacitor” and is an alias for npx capacitor, which would have been a bit too long to type in regularly.īut did you notice the npx in front of it? npx is a relatively new “package runner” from the team behind npm that allows you to run npm packages as CLI tools without globally installing them. This article describes how it works and lists all its commands and explains what they do: First published: March 2018 Overview of the Capacitor CLI, of the interactions you will have with Capacitor will be through its Command Line Interface or CLI: npx cap (or npx capacitor).
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |