-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the oneclick-ionic-ui wiki!
This will help ensure a developer has all the NPM packages necessary to create a new project or start a new project.
Test if you already have NodeJs by running
node -v
At the time of writing you should have at least v6.9.2
(current working version v8.17.0
as of 2021/03/11). If that doesn't return a result install NodeJS.
If you NodeJs is out of date then run the following:
npm cache clean -f
sudo npm install -g n
If NPM is not installed follow the instructions below then update node and npm again to ensure you are on the latest version.
Test if you already have npm by running:
npm -v
At the time of writing you should have at least 3.10.9
(current version v3.10.10
).
If npm is out of date run:
npm install npm -g
Note that as of Node version 0.6.2, NPM comes bundled with Node, so if you don't have npm installed, check your Node version.
If you have multiple projects running varying versions of Node already, then installing a Node Version Manager maybe useful. See below for links:
Test if you already have Cordova by running
cordova -v
At the time of writing you should have at least 6.4.0
(current version v8.0.0
). If Cordova is out of date or not installed run:
npm install -g cordova
or sudo npm install -g cordova
Test if you already have Ionic by running
ionic -v
At the time of writing you should have at least 2.1.18
(current version v5.4.16
as of 2021/03/11). If Ionic is out of date or not installed run:
npm install -g ionic
or sudo npm install -g ionic
Note: the ionic
CLI package that we're using is the predecessor of @ionic/cli. **Do not** install
@ionic/cli` as this will crash when you try to run the app.
Run npm install
This should auto-generate or auto-update the package-lock.json so if it doesn't do that, then check the log of your terminal.
Run in the browser:
ionic serve
BE SURE TO ALWAYS RUN THE SERVER WHILE TRYING TO TEST THE EMULATORS OR THEY WON'T RENDER ANYTHING
FIXME: Emulation instructions out of date (wilsonj806 2021/03/11)
Quick run on an emulator with logged resulst to the console:
ionic cordova emulate [platform] -l -c
ios, android,
Run on a device or simulator:
ionic cordova run ios
If that fails with an error "“Error: Cannot read property ‘replace’ of undefined”" try the following:
cd platforms/ios/cordova/
npm install ios-sim
ionic cordova run android
If that fails with an error "“Error: Cannot read property ‘replace’ of undefined”" try the following:
cd platforms/android/cordova/
npm install android
cordova platform update android
If that continues to fail go to: platfgorms/android/cordova/lib/emulator.js and change line 203 from var num = target.split('(API level ')[1].replace(')', '');
to var num = target.match(/\d+/)[0];
To start a new ionic project the command should be
ionic start <APP NAME> --type=ionic-angular
From there you will have a variety of templates to use. This project is based on the side menu.