You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2id="getting-up-and-running">Getting up and running</h2>
82
82
<p>In this chapter you're going to start with the basics, including installing the NativeScript CLI, starting a new project, and getting your first app up and running.</p>
83
83
<h3id="install-nativescript-and-configure-your-environment">Install NativeScript and configure your environment</h3>
84
-
<p>The NativeScript CLI has a few system requirements you must have in place before building NativeScript apps. If you’re new to native mobile development, start with the NativeScript CLI’s quick setup scripts, which automatically install NativeScript and its dependencies on your development machine:</p>
84
+
<p>The NativeScript CLI has a few system requirements you must have in place before building NativeScript apps. Let’s look at the steps you’ll need to take to get up and running.</p>
<p>If you have existing mobile experience, or if you want to control the installation process yourself, refer to the advanced setup instructions for your operating system:</p>
<p>The NativeScript CLI is built on Node.js, and as such you need to have Node.js installed to use NativeScript.</p>
93
+
<p>You can check whether you have Node.js installed by opening your terminal or command prompt and executing <code>node --version</code>. If you get an error, head to the <ahref="https://nodejs.org/">https://nodejs.org/</a> and download and install the latest “LTS” distribution for your development machine.</p>
94
94
<blockquote>
95
-
<p><strong>TIP</strong>: Regardless of which approach you take, setting up your machine for native development can be tricky. If you get stuck, or if you have questions at any point while going through this guide, the <ahref="http://developer.telerik.com/wp-login.php?action=slack-invitation">NativeScript Community Slack channel</a> is a great place to ask questions.</p>
95
+
<p><strong>TIP</strong>: The NativeScript CLI supports a wide variety of Node.js versions, so if you already have Node.js installed you’re likely good to go. If, by chance, you are running an unsupported version, the <code>tns doctor</code> command we’ll run momentarily will flag the problem so you can upgrade.</p>
96
96
</blockquote>
97
-
<p>After completing the setup you should have two commands available from your terminal or command prompt: <code>tns</code>—which is short for <b>T</b>elerik <b>N</b>ative<b>S</b>cript—and <code>nativescript</code>. The two commands are equivalent, so we'll stick with the shorter <code>tns</code>.</p>
97
+
<ul>
98
+
<li><strong>Step 2</strong>: Install the NativeScript CLI</li>
99
+
</ul>
100
+
<p>Open your terminal or command prompt and execute the following command to install the NativeScript CLI from npm:</p>
101
+
<pre><code>npm install -g nativescript
102
+
</code></pre><p>After completing the setup you should have two commands available from your terminal or command prompt: <code>tns</code>—which is short for <b>T</b>elerik <b>N</b>ative<b>S</b>cript—and <code>nativescript</code>. The two commands are equivalent, so we'll stick with the shorter <code>tns</code>.</p>
98
103
<p>You can verify the installation was successful by running <code>tns</code> in your terminal. You should see something like this:</p>
</code></pre><h3id="start-your-app">Start your app</h3>
113
+
</code></pre><ul>
114
+
<li><strong>Step 3</strong>: Install iOS and Android requirements</li>
115
+
</ul>
116
+
<p>When you build with NativeScript you’re building truly native iOS and Android apps, and as such, you need to have the system requirements needed to build for each platform you intend to build for on your development machine.</p>
117
+
<p>NativeScript provides two options for installing these requirements—quick setup scripts for developers new to mobile development, and advanced setup scripts for experienced mobile developers, as well as developers that want complete control over the installation process.</p>
118
+
<ul>
119
+
<li><strong>Step 3—Option A</strong>: Run quick setup scripts</li>
120
+
</ul>
121
+
<p>If you’re new to mobile development, and you’re on Windows or OS X, the NativeScript quick setup scripts are a great way to get up and running for NativeScript development.</p>
122
+
<p>If you’re on Windows, copy and paste the script below into your command prompt and press Enter:</p>
</code></pre><p>During installation you may need to accept a User Account Control prompt to grant the script administrative privileges. Also, be aware that the script downloads and installs some big dependencies—so it’s common for the script to take a while to complete.</p>
125
+
<p>If you’re on a Mac, copy and paste the script below into your terminal and press Enter:</p>
</code></pre><p>Much like the Windows script, the OS X script needs administrative access to run some commands using <code>sudo</code>; therefore, you may need to provide your password several times during execution. The OS X script also may take some time to complete, as it’s installing the dependencies for both iOS and Android development.</p>
128
+
<ul>
129
+
<li><strong>Step 3—Option B</strong>: Complete the advanced setup</li>
130
+
</ul>
131
+
<p>If you have existing mobile experience, or if you want to control the installation process yourself, refer to one of the advanced setup guide below, which walk you through manually setting up your environment for NativeScript development.</p>
<li><strong>Step 4</strong>: Verify the setup</li>
139
+
</ul>
140
+
<p>Once you’ve finished installing NativeScript and its dependencies, run the <code>tns doctor</code> command, which will check for any issues with your installation.</p>
141
+
<pre><code>tns doctor
142
+
</code></pre><p>If you see “No issues were detected” you’re good to go!</p>
143
+
<divclass="exercise-end"></div>
144
+
145
+
<p>Regardless of which approach you take, setting up your machine for native development can be tricky. If you get stuck, or if you have questions at any point while going through this guide, the <ahref="http://developer.telerik.com/wp-login.php?action=slack-invitation">NativeScript Community Slack channel</a> is a great place to ask questions.</p>
146
+
<h3id="start-your-app">Start your app</h3>
107
147
<p>With the NativeScript CLI installed, it's time to start building your app. Normally, you would <ahref="https://github.com/NativeScript/NativeScript-cli#create-project">use the <code>tns create</code> command to create an empty NativeScript application</a>. For this guide however, we've scaffolded out a boilerplate project to act as a starting point for <ahref="https://github.com/NativeScript/sample-Groceries">Groceries</a>.</p>
Copy file name to clipboardExpand all lines: src/chapters/chapter1.md
+68-7Lines changed: 68 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,22 +4,34 @@ In this chapter you're going to start with the basics, including installing the
4
4
5
5
### Install NativeScript and configure your environment
6
6
7
-
The NativeScript CLI has a few system requirements you must have in place before building NativeScript apps. If you’re new to native mobile development, start with the NativeScript CLI’s quick setup scripts, which automatically install NativeScript and its dependencies on your development machine:
7
+
The NativeScript CLI has a few system requirements you must have in place before building NativeScript apps. Let’s look at the steps you’ll need to take to get up and running.
If you have existing mobile experience, or if you want to control the installation process yourself, refer to the advanced setup instructions for your operating system:
The NativeScript CLI is built on Node.js, and as such you need to have Node.js installed to use NativeScript.
16
+
17
+
You can check whether you have Node.js installed by opening your terminal or command prompt and executing `node --version`. If you get an error, head to the https://nodejs.org/ and download and install the latest “LTS” distribution for your development machine.
16
18
17
-
> **TIP**: Regardless of which approach you take, setting up your machine for native development can be tricky. If you get stuck, or if you have questions at any point while going through this guide, the [NativeScript Community Slack channel](http://developer.telerik.com/wp-login.php?action=slack-invitation) is a great place to ask questions.
19
+
> **TIP**: The NativeScript CLI supports a wide variety of Node.js versions, so if you already have Node.js installed you’re likely good to go. If, by chance, you are running an unsupported version, the `tns doctor` command we’ll run momentarily will flag the problem so you can upgrade.
20
+
21
+
***Step 2**: Install the NativeScript CLI
22
+
23
+
Open your terminal or command prompt and execute the following command to install the NativeScript CLI from npm:
24
+
25
+
```
26
+
npm install -g nativescript
27
+
```
18
28
19
29
After completing the setup you should have two commands available from your terminal or command prompt: `tns`—which is short for <b>T</b>elerik <b>N</b>ative<b>S</b>cript—and `nativescript`. The two commands are equivalent, so we'll stick with the shorter `tns`.
20
30
21
31
You can verify the installation was successful by running `tns` in your terminal. You should see something like this:
When you build with NativeScript you’re building truly native iOS and Android apps, and as such, you need to have the system requirements needed to build for each platform you intend to build for on your development machine.
48
+
49
+
NativeScript provides two options for installing these requirements—quick setup scripts for developers new to mobile development, and advanced setup scripts for experienced mobile developers, as well as developers that want complete control over the installation process.
50
+
51
+
***Step 3—Option A**: Run quick setup scripts
52
+
53
+
If you’re new to mobile development, and you’re on Windows or OS X, the NativeScript quick setup scripts are a great way to get up and running for NativeScript development.
54
+
55
+
If you’re on Windows, copy and paste the script below into your command prompt and press Enter:
During installation you may need to accept a User Account Control prompt to grant the script administrative privileges. Also, be aware that the script downloads and installs some big dependencies—so it’s common for the script to take a while to complete.
62
+
63
+
If you’re on a Mac, copy and paste the script below into your terminal and press Enter:
Much like the Windows script, the OS X script needs administrative access to run some commands using `sudo`; therefore, you may need to provide your password several times during execution. The OS X script also may take some time to complete, as it’s installing the dependencies for both iOS and Android development.
70
+
71
+
***Step 3—Option B**: Complete the advanced setup
72
+
73
+
If you have existing mobile experience, or if you want to control the installation process yourself, refer to one of the advanced setup guide below, which walk you through manually setting up your environment for NativeScript development.
Once you’ve finished installing NativeScript and its dependencies, run the `tns doctor` command, which will check for any issues with your installation.
83
+
84
+
```
85
+
tns doctor
86
+
```
87
+
88
+
If you see “No issues were detected” you’re good to go!
89
+
90
+
<divclass="exercise-end"></div>
91
+
92
+
Regardless of which approach you take, setting up your machine for native development can be tricky. If you get stuck, or if you have questions at any point while going through this guide, the [NativeScript Community Slack channel](http://developer.telerik.com/wp-login.php?action=slack-invitation) is a great place to ask questions.
93
+
33
94
### Start your app
34
95
35
96
With the NativeScript CLI installed, it's time to start building your app. Normally, you would [use the `tns create` command to create an empty NativeScript application](https://github.com/NativeScript/NativeScript-cli#create-project). For this guide however, we've scaffolded out a boilerplate project to act as a starting point for [Groceries](https://github.com/NativeScript/sample-Groceries).
0 commit comments