Npm Install g Cordova Ionic Error Please Try Running This Command Again as Root administrator
Previous: All About Ionic
Chapter 2: Installation
In this chapter, nosotros are going to walk through the process of downloading Ionic and installing all necessary dependencies for evolution.
Platform notes
First, we demand to start with a annotation virtually minimum requirements for building your app with the current release of Ionic. Ionic targets iPhone and Android devices (currently). Nosotros support iOS 7+, and Android iv.one+. However, since there are a lot of different Android devices, information technology'south possible certain ones might not work. As always, we are looking for assistance testing and improving our device compatibility and would dear help from the community on our GitHub projection.
Y'all tin develop Ionic apps on any operating organisation you prefer. In fact, Ionic has been developed at diverse times on Mac Os 10, Linux, and Windows. However, right now you'll demand to employ the command line in lodge to follow this guide and yous must have OS X in order to develop and deploy iPhone apps, so Bone X is recommended if possible.
If y'all are on Windows, brand sure to download and install Git for Windows and optionally Console2. Yous will be executing whatsoever commands in this guide in the Git Fustigate or Console2 windows.
First, nosotros will get and install the nigh contempo version of Apache Cordova, which volition accept our app and bundle it into a native wrapper to turn information technology into a traditional native app.
To install Cordova, make sure you have Node.js installed, and then run
$ sudo npm install -thou cordova Drop sudo from the in a higher place command if running on Windows. Depending on the platforms yous wish to develop for, y'all'll need to install platform-specific tools. Follow the Cordova platform guides for Android and iOS to make sure you have everything needed for development on those platforms. Luckily, yous'll just need to practise this once.
If y'all are running a 64-chip version of Ubuntu, yous'll need to install the 32-bit libraries since Android is just 32-scrap at the moment. $ sudo apt-get install ia32-libs If you are on Ubuntu thirteen.04 or greater, `ia32-libs` has been removed. You can utilise the post-obit packages instead: $ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
If you are running 64-bit version of Fedora you'll need to install some 32-chip packages: $ sudo yum install -y glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686
ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
Windows users developing for Android: Yous'll want to make sure you lot take the following installed and set.
Notation: Whenever you make changes to the PATH, or whatever other environment variable, you lot'll demand to restart or open a new tab in your beat out program for the PATH change to have effect.
Java JDK
Install the almost recent Java eight JDK (NOT just the JRE), JDK 9 is Non currently (2017.12) supported by Cordova.
Next, create an environment variable for JAVA_HOME pointing to the root folder where the Java JDK was installed. And so, if you installed the JDK into C:\Plan Files\Java\jdk7, set up JAVA_HOME to be this path. After that, add together the JDK's bin directory to the PATH variable too. Following the previous assumption, this should exist either %JAVA_HOME%\bin or the total path C:\Program Files\Coffee\jdk7\bin
Apache Pismire
To install Ant, download a zip from here, extract information technology, motility the commencement binder in the nix to a condom place, and update your PATH to include the bin folder in that folder. For instance, if you moved the Pismire folder to c:/, you'd want to add this to your PATH: C:\apache-pismire-i.9.ii\bin.
Android SDK
Installing the Android SDK is also necessary. The Android SDK provides you lot the API libraries and programmer tools necessary to build, test, and debug apps for Android.
Cordova requires the ANDROID_HOME environment variable to be set. This should point to the [ANDROID_SDK_DIR]\android-sdk directory (for example c:\android\android-sdk).
Next, update your PATH to include the tools/ and platform-tools/ folder in that folder. And then, using ANDROID_HOME, you would add both %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools.
Install Ionic
Ionic comes with a user-friendly command line utility to start, build, and parcel Ionic apps.
To install it, simply run:
$ sudo npm install -m ionic Create the projection
At present, nosotros need to create a new Cordova project somewhere on the reckoner for the code for our app:
$ ionic first todo blank --type ionic1 That will create a folder called todo in the directory the command was run. Next, nosotros will become into that directory and listing the contents. Hither is what the outer construction of your Ionic project volition await like:
$ cd todo && ls ├── bower.json // bower dependencies ├── config.xml // cordova configuration ├── gulpfile.js // gulp tasks ├── hooks // custom cordova hooks to execute on specific commands ├── ionic.project // ionic configuration ├── package.json // node dependencies ├── platforms // iOS/Android specific builds volition reside here ├── plugins // where your cordova/ionic plugins will be installed ├── scss // scss lawmaking, which will output to www/css/ └── www // application - JS code and libs, CSS, images, etc. If y'all are planning on using any version command system, you can get ahead and set it upward in this new folder.
Configure Platforms
Now, we need to tell ionic that we desire to enable the iOS and Android platforms. Note: unless you are on MacOS, leave out the iOS platform:
$ ionic cordova platform add ios $ ionic cordova platform add android If you see errors hither, make sure to follow the platform guides to a higher place to install necessary platform tools.
If you lot get this error: [Error: Error : Make sure JAVA_HOME is ready, as well equally paths to your JDK and JRE for java.] Then effort running this command outset earlier adding the android platform:
$ export JAVA_HOME=$(/usr/libexec/java_home)
Test information technology out
Just to make sure the default projection worked, try building and running the project (substitute ios for android to build for Android instead):
$ ionic cordova build ios $ ionic cordova emulate ios We don't recommend using "emulate" for Android development. Unfortunately, the default Android emulator is horribly wearisome and volition not accurately represent a real device. Using the emulator isn't even recommended for native Android development.
Fortunately, at that place are some cracking alternatives out at that place. Our favorite is a tool called Genymotion which can run an Android device as a virtual machine on your computer. Information technology's much faster! If you apply Genymotion, yous'll use ionic cordova run instead of ionic cordova emulate as a Genymotion epitome appears equally a physical device to the operating system.
If you chose to emulate on Android, exist patient as this takes several minutes every bit the Android emulator is booted up. If you lot don't encounter anything happen for a few minutes, make sure yous've created an Android Virtual Device (AVD), and that it is using the Android SDK version 17 or above. You might have to reduce the amount of memory the AVD is using if y'all don't see the emulator boot up in a infinitesimal. The platform guide to a higher place has more than information. Yous may too desire to double check that you lot accept the sdk and platform tools in your PATH equally noted in the platform guide.
The emulator takes a LONG time to boot. After virtually 5 or ten minutes, you should see the default Cordova app running in the emulator:
Of class, you can always examination directly on the device, and that is the recommended way to develop on Android due to the slow emulator. To do that, substitute emulate with run and ensure you have an Android device connected to the computer.
Let's go!
At present nosotros are ready to get-go edifice our app, so go along on to the next chapter:
Affiliate 3: Starting your app
Source: https://ionicframework.com/docs/v1/guide/installation.html
0 Response to "Npm Install g Cordova Ionic Error Please Try Running This Command Again as Root administrator"
Post a Comment