How to install Ionic framework on Ubuntu?

2019-02-02 15:22发布

问题:

I am using Ubuntu 14.04 version. I would like to use Ionic to build app for Android. I couldn't find exact solution to install Ionic.

回答1:

See the Cordova Platform Guide here and the Ionic Installation Guide here, but I'm highlighting the key steps for Ubuntu.

  1. Install JDK 8. (This part was taken from this question).

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
    sudo apt-get install oracle-java8-set-default
    
  2. Install node.js 0.12. NodeSource install guide for Ubuntu and co.

  3. Install Android Studio and the Android SDK from Google. (I will refer to the folder where you install as where-you-unpacked-the-sdk later.)

  4. Using a terminal, install the Ionic CLI and related tools.

    sudo apt-get install git ruby
    sudo gem install compass
    sudo npm install -g cordova ionic grunt-cli bower gulp
    
  5. Add the Android SDK to your PATH and set the ANDROID_HOME environment variable correctly. Using ~/.bash_profile for this is the usual approach.

    echo "export ANDROID_HOME=/where-you-unpacked-the-sdk/sdk" >> ~/.bash_profile
    echo "export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" >> ~/.bash_profile
    source ~/.bash_profile
    
  6. Start using Ionic!

    ionic start todo example
    cd example
    ionic platform add android
    ionic run android
    


回答2:

Go to github clone the link to your directory: [ https://github.com/nraboy/ubuntu-ionic-installer ]

git clone https://github.com/nraboy/ubuntu-ionic-installer

after cloning, go to the directory - ubuntu-ionic-installer:

cd ubuntu-ionic-installer

chmod 775 ubuntu_ionic_installer.sh

sudo ./ubuntu_ionic_installer.sh

Then get coffee and relax until the install is done you can

to check just type ionic in the terminal



回答3:

IONIC2 beta installation

Step 1: All basic installation in one step,

https://github.com/nraboy/ubuntu-ionic-installer

Step 2: But above link give old version of nodeJS. So uninstall nodejs.

$ apt-get remove nodejs

Step 3: Then Install latest version of nodeJs

$ sudo apt-get install curl
$ curl --silent --location https://deb.nodesource.com/setup_5.x | sudo bash -
$ sudo apt-get install nodejs

Step 4: Install latest NVM - nodejs verions manager

$ sudo apt-get install build-essential libssl-dev
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash

Step 5: Important Note

Here you'll need to restart your bash session in order to get nvm loaded - available on path (close / open terminal).

Step 7:

$ nvm install 5.4.1
$ nvm use 5.4.1

$ node --version
  v5.4.1
$ npm --version
  3.3.12

Step 8 Then finally install ionic2 beta version (don`t forget sudo)

$ sudo npm install -g ionic@beta
$ ionic --version
  2.0.0-beta.17

I give this answer based on these links,

https://forum.ionicframework.com/t/ionic2-installation-on-ubuntu-14-04/41183/3

http://ionicframework.com/docs/v2/getting-started/installation/

Note: I am at beginnerlevel of ubuntu environment & also ionic environment.so this answer may be contains mistakes.If any mistakes correct me.



回答4:

As Others have stated: Install the following:

  • Java (oracle 8+)
  • Ant
  • git
  • node
  • android sdk (may need lib32)
  • cordova
  • ionic itself
  • bower, grunt, gulp

So Java+git+abt first:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
sudo apt-get install ant git

choose an Node version:

#0.12
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -

or

#5.x
https://deb.nodesource.com/setup_5.x

eitherway:

sudo apt-get install -y nodejs

If you're on an x64 machine:

sudo apt-get install ia32-libs lib32ncurses5-dev lib32stdc++6

if ia32-libs+lib32ncurses5 are not found use:

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

Next: Android Sdk Download AndroidStudio/ or Standalone Sdk. I would recommend Studio, as it simplifies the installation-process a lot

  • download from Android.com
  • unzip to arbitrary location
  • run studio.sh (in /XY-location/Android-Sdk_linux/bin)
  • Add SDK to PATH: append to ~/.bash_profile or ~/.profile

    export ANDROID_HOME=/home/xyx/Android/sdk export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Finally install the node modules

sudo npm install -g gulp bower grunt-cli cordova

And ionic

sudo npm install -g ionic

or for ionic v2 (still in alpha state but cool++)

sudo npm install -g ionic@alpha