- Ionic:Hybrid Mobile App Development
- Rahat Khanna Sani Yusuf Hoc Phan
- 518字
- 2021-07-09 19:00:32
Ionic development environment
Ionic Framework is based on Apache Cordova, which takes care of build and plugin management. Apache Cordova CLI uses the NodeJS package manager called NPM for dependency management.
Installing NodeJS
NodeJS is a JavaScript-based server-side environment to build backend systems. NodeJS has an efficient package manager that takes care of installing and maintaining a central repository of packages, version management, and dependency management. NPM has become the default dependency manager for a lot of other frameworks apart from NodeJS. Ionic Framework also leveraged this successful package manager so we have to install it for Hybrid App development.
In order to install NodeJS, download the binary for the respective OS—Windows, Linux, or Mac OS from https://nodejs.org/download/.
On a Mac or Linux, you can use a package manager such as brew to install NodeJS:
$ brew install node
After the node installation is complete, please type in the following commands to test the installation:
$ node -v $ npm -v
The appropriate installed version for node and npm will be written to the output.
There is a config.json
file generated that stores the dependent modules and meta information about the specific NodeJS project.
In order to install any npm package, the install
command is used. It has an optional flag -g
for installing any package globally so that it is accessible from anywhere. All the CLI packages such as Cordova CLI and Ionic CLI will be installed using these commands only. In order to update a package, run the second command:
$ npm install -g <package_name> $ npm update -g <package_name>
Installing Cordova CLI and Ionic CLI
Cordova will be installed using the npm utility discussed previously. The Cordova CLI includes a set of scripts to automate the Cordova build process for wrapping of web content into Native Mobile Apps. It also includes commands to manage plugins. As discussed in Chapter 1, All About Hybrid Mobile Apps and Ionic Framework, Cordova is based on an architecture where the core library is included by default, but extra functionality needs to be utilized using plugins.
In order to install Cordova, use the npm global install
command as follows:
- On a Mac/Linux machine:
$ npm install -g cordova
- On a Windows machine:
C:\>npm install -g cordova
Cordova installation can be confirmed by checking the version of the installed package as follows:
$ cordova -v
The Ionic command-line interface provides an easy-to-use interface to perform basic functions such as creating an app, adding a platform, and building apps. It also provides commands to use Ionic platform services helping in rapid development of Hybrid Apps. Ionic CLI is installed in a method similar to Cordova with the following commands:
- On a Mac/Linux machine:
$ npm install -g ionic
- On a Windows machine:
C:\>npm install -g ionic
Ionic CLI extends the Cordova CLI and hence most of the Cordova commands need not be run directly. They can be run using the ionic
keyword, where internally the Cordova package will be used. You can also view a list of exhaustive Ionic commands by executing ionic help
.
- 深入核心的敏捷開發:ThoughtWorks五大關鍵實踐
- Visual C++程序設計教程
- R語言數據可視化之美:專業圖表繪制指南
- 從程序員到架構師:大數據量、緩存、高并發、微服務、多團隊協同等核心場景實戰
- 薛定宇教授大講堂(卷Ⅳ):MATLAB最優化計算
- Internet of Things with Intel Galileo
- Building Minecraft Server Modifications
- Oracle 18c 必須掌握的新特性:管理與實戰
- 匯編語言編程基礎:基于LoongArch
- R用戶Python學習指南:數據科學方法
- Learning Cocos2d-JS Game Development
- Java 9:Building Robust Modular Applications
- Practical Responsive Typography
- MonoTouch應用開發實踐指南:使用C#和.NET開發iOS應用
- PHP高性能開發:基礎、框架與項目實戰