官术网_书友最值得收藏!

Installing NativeScript

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.

Prerequisites

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).

node.js

For the nativescript command to be installed and to make it work, you must first install node.js, which can be downloaded and installed from and already pre-converted to JavaScript before you even download it. It uses node.js and several other common modules to perform all its work.

iOS

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

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.

Installation

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.

Tip

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.

Type 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.

Once the NativeScript command and required support tools are installed, you are all ready to begin developing NativeScript applications.

Installation help

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.

主站蜘蛛池模板: 朔州市| 安岳县| 斗六市| 大庆市| 安乡县| 历史| 大同市| 北海市| 长治市| 孝昌县| 金华市| 宁远县| 南投县| 阳山县| 华蓥市| 临清市| 迭部县| 宁武县| 雅安市| 科技| 武夷山市| 类乌齐县| 阿瓦提县| 武威市| 镇巴县| 长顺县| 乐亭县| 苗栗县| 泸州市| 乌鲁木齐县| 德令哈市| 治多县| 临颍县| 福鼎市| 沂南县| 高安市| 怀远县| 仁布县| 秀山| 岳西县| 五常市|