Install ionic on Cent OS 7

I want to develop an app. It was recommended to me to do it using ionic.  My system is Cent OS 7. This is the story of how I reached a healthy ionic framework. The Ampersand academy has a short how-to, that I tried without success. So what is wrong? When I try

curl --silent --location https://rpm.nodesource.com/setup_5.x 
| bash -

That results in this nice warning:

DEPRECATION WARNING
Node.js v5.x is no longer actively supported!

Anyway, I continue

yum install -y nodejs
 yum install -y gcc-c++ make
 npm version
1.4.21
 yum install git
 git --version
git version 1.8.3.1
npm install -g cordova ionic

Ends up with all kind of errors. Also if I run npm step by step. The errors look like:

 something: wanted: {"node":">=4.0"} 
(current: {"node":"0.10.30","npm":"1.4.21"})

So let’s fix node and try again. I don’t know why I didn’t try it before, but there is a nodejs package on the epel repository. I first remove what I just installed (that ended up on /usr/local/bin) and do as written:

yum install epel-releaseyum install nodejs
yum install npm

To be sure, I open a new shell and check the versions.

$ node --version
v6.10.3
$ npm --version
3.10.10

That’s much better. I go back to a root shell, and install cordova and ionic. This is my output:

# npm install -g cordova
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/bin/cordova -> /usr/lib/node_modules/cordova/bin/cordova
/usr/lib
└─┬ cordova@7.0.1 
 └─┬ cordova-lib@7.0.1
 └─┬ cordova-js@4.2.1
 └─┬ browserify@13.3.0
 └── crypto-browserify@3.11.1

# npm install -g ionic
/usr/bin/ionic -> /usr/lib/node_modules/ionic/bin/ionic
- has-ansi@2.0.0 node_modules/ionic/node_modules/has-ansi
...something here...
- strip-ansi@4.0.0 node_modules/ionic/node_modules/
string-width/node_modules/strip-ansi
/usr/lib
└─┬ ionic@3.5.0 
 ├─┬ @ionic/cli-utils@1.5.0 
 │ ├── ci-info@1.0.0 
 │ ├── slice-ansi@1.0.0 
 │ ├─┬ strip-ansi@4.0.0 
 │ │ └── ansi-regex@3.0.0 
 │ └─┬ wrap-ansi@2.1.0
 │ └─┬ strip-ansi@3.0.1 
 │ └── ansi-regex@2.1.1 
 └─┬ chalk@2.0.1 
 ├── ansi-styles@3.1.0 
 └── supports-color@4.2.0

Will it work? Time to test. I open a normal shell, and try as suggested to create a todo project. This is my output:

ionic start todo blank --type ionic1
✔ Creating directory ./todo - done!
[INFO] Fetching app base
 (https://github.com/ionic-team/ionic-app-base/
archive/master.tar.gz)
✔ Downloading - done!
[INFO] Fetching starter template blank
 (https://github.com/ionic-team/ionic-starter-blank/
archive/master.tar.gz)
✔ Downloading - done!
[INFO] Fetching resources
 (https://github.com/ionic-team/ionic-default-resources/
archive/master.tar.gz)
✔ Downloading - done!
✔ Updating package.json with app details - done!
✔ Creating configuration file ionic.config.json - done!
[INFO] Installing dependencies may take several minutes!
> npm install
✔ Running command - done!
> npm install --save-dev --save-exact 
@ionic/cli-plugin-ionic1@latest
✔ Running command - done!
> npm install --save-dev --save-exact 
@ionic/cli-plugin-gulp@latest
✔ Running command - done!
> git init
✔ Running command - done!
> git add -A
✔ Running command - done!
> git commit -m "Initial commit" --no-gpg-sign
✔ Running command - done!
♬ ♫ ♬ ♫ Your Ionic app is ready to go! ♬ ♫ ♬ ♫
Run your app in the browser (great for initial development):
 ionic serve
Run on a device or simulator:
 ionic cordova run ios
Test and share your app on a device with the Ionic View app:
 http://view.ionic.io 
? Link this app to your Ionic Dashboard 
to use tools like Ionic View? Yes

You will need to login in order to link this app. 
Please run the following commands to do so.
 ionic login - login first
 ionic link - then link your app

Go to your newly created project: cd ./todo

And I’m also able to see it on the browser.

cd todo/
$ ionic serve
[INFO] Starting server: --port=8100 --p=8100 
--livereload-port=35729 --r=35729
 --address=0.0.0.0 - Ctrl+C to cancel
[INFO] Development server running
 Local: http://localhost:8100

Everything seems to work. It’s time now to get serious and start coding ❤

 

Advertisements

About bitsanddragons

A traveller, an IT professional and a casual writer
This entry was posted in bits, centos, linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s