In the following section, we will go over the tools needed to develop our Aurelia application.
Aurelia being a JavaScript framework, it just makes sense that its development tools are also in JavaScript. This means that the first thing you need to do when getting started with Aurelia is to install Node.js and NPM on your development environment.
Note
Node.js is a server-side runtime environment based on Google's V8 JavaScript engine. It can be used to build complete websites or web APIs, but it is also used by a lot of front-end projects for development and to build tasks, such as transpiling, linting, and minimizing.
NPM is the de facto package manager for Node.js. It uses http://www.npmjs.com as its main repository, where all available packages are stored. It is bundled with Node.js, so if you install Node.js on your computer, NPM will also be installed.
To install Node.js and NPM on your development environment, you simply need to go to https://nodejs.org/ and download the proper installer for your environment.
If Node.js and NPM are already installed, I strongly recommend that you make sure to use at least version 3 of NPM, as older versions may have issues collaborating with some of the other tools we'll use. If you are not sure which version you have, you can check it by running the following command in a console:
> npm -v
If Node.js and NPM are already installed but you need to upgrade NPM, you can do so by running the following command:
> npm install npm -g
Even though an Aurelia application can be built using any package manager, build system, or bundler you want, the preferred tool to manage an Aurelia project is the command line interface, a.k.a. the CLI.
At the time of writing, the CLI only supports NPM as its package manager and requirejs
as its module loader and bundler, probably because they are both the most mature and stable. It also uses Gulp 4 behind the scenes as its build system.
CLI-based applications are always bundled when running, even in development environments. This means that the performance of an application during development will be very close to what it should be like in production. This also means that bundling is a recurring concern, as new external libraries must be added to some bundles in order to be available at runtime. We'll see this in detail in Chapter 10, Bundling for Production.
In this book, we'll stick with the preferred solution and use the CLI. There are, however, two appendices at the end of the book covering alternatives, a first for Webpack, and a second for SystemJS with JSPM.
The CLI being a command line tool, it should be installed globally, by opening a console and executing the following command:
> npm install -g aurelia-cli
You may have to run this command with administrator privileges, depending on your environment.
If you already have it installed, make sure you have the latest version, by running the following command:
> au -v
You can then compare the version this command outputs with the latest version number tagged on GitHub, at https://github.com/aurelia/cli/releases/latest.
If you don't have the latest version, you can simply update it by running the following command:
> npm install -g aurelia-cli
If for some reason the command to update the CLI fails, simply uninstall then reinstall it:
> npm uninstall aurelia-cli -g > npm install aurelia-cli -g
This should reinstall the latest version.