5 min read

In this article by Sergey Akopkokhyants, author of the book Learning Web Development with Bootstrap and Angular (Second Edition), will establish a development environment for the simplest application possible.

(For more resources related to this topic, see here.)

Development environment setup

It’s time to set up your development environment. This process is one of the most overlooked and often frustrating parts of learning to program because developers don’t want to think about it. The developers must know nuances how to install and configure many different programs before they start real development. Everyone’s computers are different as a result; the same setup may not work on your computer. We will expose and eliminate all of these problems by defining the various pieces of environment you need to setup.

Defining shell

The shell is a required part of your software development environment. We will use the shell to install software, run commands to build and start the web server to bring the life to your web project. If your computer has installed Linux operating system then you will use the shell called Terminal. There are many Linux-based distributions out there that use diverse desktop environments, but most of them use the equivalent keyboard shortcut to open the Terminal.

Use keyboard shortcut Ctrl + Alt + T to open Terminal in Linux.

If you have a Mac computer with installed OS X, then you will use the Terminal shell as well.

Use keyboard shortcut Command + Space to open the Spotlight, type Terminal to search and run.

If you have a computer with installed Windows operation system, you can use the standard command prompt, but we can do better. In a minute later I will show you how can you install the Git on your computer, and you will have Git Bash free.

You can open a Terminal with Git Bash shell program on Windows.

I will use the shell bash for all exercises in this book whenever I need to work in the Terminal.

Installing Node.js

The Node.js is technology we will use as a cross-platform runtime environment for running server-side Web applications. It is a combination of native, platform independent runtime based on Google’s V8 JavaScript engine and a huge number of modules written in JavaScript. Node.js ships with different connectors and libraries help you use HTTP, TLS, compression, file system access, raw TCP and UDP, and more. You as a developer can write own modules on JavaScript and run them inside Node.js engine. The Node.js runtime makes ease build a network, event-driven application servers.

The terms package and library are synonymous in JavaScript so that we will use them interchangeably.

Node.js is utilizing JavaScript Object Notation (JSON) format widely in data exchange between server and client sides because it readily expressed in several parse diagrams, notably without complexities of XML, SOAP, and other data exchange formats.

You can use Node.js for the development of the service-oriented applications, doing something different than web servers. One of the most popular service-oriented application is Node Package Manager (NPM) we will use to manage library dependencies, deployment systems, and underlies the many platform-as-a-service (PaaS) providers for Node.js.

If you do not have Node.js installed on your computer, you shall download the pre-build installer from https://nodejs.org/en/download. You can start to use the Node.js immediately after installation. Open the Terminal and type:

node ––version

The Node.js must respond with version number of installed runtime:

v4.4.3

Setting up NPM

The NPM is a package manager for JavaScript. You can use it to find, share, and reuse packages of code from many developers across the world. The number of packages dramatically grows every day and now is more than 250K. NPM is a Node.js package manager and utilizes it to run itself. NPM is included in setup bundle of Node.js and available just after installation. Open the Terminal and type:

npm ––version

The NPM must answer on your command with version number:

2.15.1

The following command gives us information about Node.js and NPM install:

npm config list

There are two ways to install NPM packages: locally or globally. In cases when you would like to use the package as a tool better install it globally:

npm install ––global <package_name>

If you need to find the folder with globally installed packages you can use the next command:

npm config get prefix

Installation global packages are important, but best avoid if not needed. Mostly you will install packages locally.

npm install <package_name>

You may find locally installed packages in a node_modules folder of your project.

Installing Git

You missed a lot if you are not familiar with Git. Git is a distributed version control system and each Git working directory is a full-fledged repository. It keeps the complete history of changes and has full version tracking capabilities. Each repository is entirely independent of network access or a central server.

You can install Git on your computer via a set of pre-build installers available on official website https://git-scm.com/downloads. After installation, you can open the Terminal and type

git –version

Git must respond with version number

git version 2.8.1.windows.1

As I said for developers who use computers with installed Windows operation system now, you have Git Bash free on your system.

Code editor

You can imagine how many programs for code editing exists but we will talk today only about free, open source and runs everywhere Visual Studio Code from Microsoft. You can use any program you prefer for development, but I use only Visual Studio Code in our future exercises, so please install it from http://code.visualstudio.com/Download.

Summary

This article, we learned about shell concept, how to install Node.js and Git, and setting up node packages.

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here