A.2. Installing Phoenix

Hex is the package manager for Elixir, and because Phoenix is a package, you need to ensure that Hex is installed. After you successfully install Elixir, run the following command:

> mix local.hex

Phoenix itself uses Mix to run commands related to working with Phoenix applications. Because of that, a special archive file needs to be downloaded by Hex:

> mix archive.install hex phx_new 1.4.0

This file, once installed by Mix, is used along with Mix to create new Phoenix applications.

Note that this archive is tied to a specific version of Phoenix (1.4.0, in this case). When Phoenix updates its generators, you need to rerun this command with the new version number.

A.2.1. PostgreSQL

This isn’t technically a prerequisite, but if you follow along directly with this book, you need PostgreSQL installed. We’ll be working with a database in many of the chapters, and the default database preference for Phoenix is PostgreSQL. That’s what I’ve used. If you prefer to use MySQL or some other database that Ecto supports (see https://github.com/elixir-ecto/ecto#usage for support details), you need to modify the code listings in the book to match.

If you’d like to install PostgreSQL, check out the PostgreSQL wiki at https://wiki.postgresql.org/wiki/Detailed_installation_guides for detailed instructions for your system.

A.2.2. Node.js

To compile assets like CSS files and JavaScript, Phoenix uses Webpack, and Webpack requires Node.js to be installed. Webpack will be installed by Mix when needed, but Node.js should be installed to make sure Mix can install Webpack and other dependencies.

You can install Node.js with your preferred package manager (such as Homebrew) or via Node’s download page at https://nodejs.org/en/download/. Note that Phoenix requires a Node.js version of 5.0.0 or greater.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.184.89