2.1 Install NativeScript
In this lesson we’ll install Node and the NativeScript CLI as well as set up both the iOS and Android SDKs. NativeScript is still evolving, so make sure to always check the official documentation for any changes.
On Windows, use:
npm install -g nativescript @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
On macOS, install with:
sudo npm install -g nativescript ruby -e "$(curl -fsSL https://www.nativescript.org/setup/mac)"
1.Introduction3 lessons, 04:03
2.Code a Mobile App9 lessons, 55:16
3.Conclusion1 lesson, 00:49
2.1 Install NativeScript
To set up the environment you need to download and install node js. Simply open a terminal window and execute the command node --version. If you get an error, go to nodejs.org and download the latest lts longterm support version for your platform. Next, you need to download the NativeScript CLI npm, which is Node.js package manager. Simply type the command $npm install -g nativescript. And -g flag means we are installing it globally. If you're using a Mac, make sure that you start the command with sudo for administrative privileges, which will ask for your password. During the installation, you might encounter some questions. For the time being, we would answer no to all of them, while we're going to cover them later in the course. After installing NativeScript, you have access to two commands, nativescript and tns. Which is the shorthand version for Telerik NativeScript. In this course, we're going to use this version. To make sure that you have installed it correctly, try tns --version. Next, we need to install iOS and Android requirements. NativeScript apps are truly native iOS and Android apps. Thus for such developments, you need to have access to these platforms. To set up iOS SDK, you need to download Xcode. And to install Android SDK, it is better to download Android Studio. But, don't worry. We are not going to use them building nativescript apps. Good news is nativescript's CLI provides quick starter scripts for the OSX and Windows. That handle the necessary setup for you automatically. These scripts can be found under installation section of nativescript's official documentation. Windows users can download this link, and OSX users should use the second one. I also have included these links on the course notes. I have to say it takes a long time for this command to download and install all requirements. And it might ask you multiple times to enter your password because it uses sudo command. Once a script is done, close and restart the terminal on OSX or command prompt if you are on Windows. Finally, to make sure that everything is working properly try tns doctor. Very well, in the next video, we're going to cover NativeScript CLI and show you how to create an application and run it in emulator.