We are going to cover what you'll need for installation and development. Then, we will discuss how to install the NativeScript command, which you will use for anything relating to your NativeScript project.
To get started on our journey of using NativeScript, we first must have several tools installed. The primary tool you will use for virtually everything is the
nativescript command, or you can alternatively use the shorter alias of
tns (short for Telerik NativeScript).
nativescript command to be installed and to make it work, you must first install
node.js, which can be downloaded and installed from https://nodejs.org/. The
node.js and several other common modules to perform all its work.
If you are planning on distributing your app on any iOS devices, you will need to have access to an Apple Macintosh platform. This is a requirement by Apple as they only allow you to compile and upload the app to the app store from a Macintosh. The Macintosh must have the Xcode and Xcode command-line tools installed. It is also highly recommended that you have an iPhone 4s or better to test at least the final application before you distribute it. The iOS emulator is not very accurate and because it gives you an idea of how your app will look, an actual device will accurately show you what your customers will see. The specific install instructions for iOS can be found at http://docs.nativescript.org/setup/ns-cli-setup/ns-setup-os-x.html.
Android is a lot easier because you can execute development for Android on Linux, OSX, and Windows. For Android, you need to install Java JDK and then the Android SDK and tools. I also highly recommend that you install an optional third-party Android emulator rather than use the stock Android emulator. The third-party emulators are considerably faster than both the stock Android emulator and the add-on Intel HAXM emulator. The stock emulator and Intel HAXM can be downloaded via the Android SDK Manager. The instructions on the NativeScript site can walk you through installing all the tools that you will need for building and testing your application. The specific instructions for each of the platforms are located at http://docs.nativescript.org/setup/quick-setup#the-nativescript-cli.
Once you have
node.js installed, you just need to do a simple
npm install –g nativescript at a terminal shell (or known on Windows as a command prompt window). And then
npm will download and install the required NativeScript code and command-line tool. It will install it globally so that it can be used from any project you are working on.
With the command path on Linux and Macintosh, the global commands are normally placed in
/usr/local/bin, which is typically already in your path, so the
nativescript command should work right away.
On Windows, unfortunately, you might have to add the path where
npm installs the program globally. Type
nativescript and see if it runs. If it fails to run, then you need to add npm's global directory to your path. Type
npm config get prefix to get the current global directory.
systempropertiesadvanced , then click the Environment Variables button, then click on PATH, and finally, click the Edit button. Then, you can type a semicolon and add in the directory path to the all the
npm global commands like the NativeScript command. So, your path might look something like this:
C:\windows;c:\windows\system;c:\program files (x86)\nodejs.
Sometimes, getting NativeScript installed properly can be difficult because of all the differences between computers. Here are a couple places you can go to get help if you need it: https://groups.google.com/forum/#!forum/nativescript and https://plus.google.com/communities/117408587889337015711.