Setting up Habitica Locally using Docker

Git Settings for Windows Line Endings
This section is only relevant if you are using Docker on a Windows PC.

* nix operating systems (Linux and Mac OS X) handle line endings differently than Windows. *nix systems use the line feed (LF) character, while Windows uses a combination of a carriage return and line feed,   (CRLF). Since Habitica developers use a variety of operating systems, to allow for maximum compatibility, Git on Windows must be set up to ensure that only LF line endings are committed to the repo.

How you set this up depends on whether you will be doing all your code editing directly in Windows or in the Docker container. The appropriate setting can be chosen when installing Git (see the screenshot but read on before you chose an option) or afterwards using a simple command-line tool.

If you will be doing all your code editing in the Docker container, then when presented with the "Configuring the line ending conversions" window, select "Checkout as-is, commit Unix-style line endings". Alternatively, configure that setting from the command line by running

If you will be doing your code editing directly on your Windows host machine (i.e., you are using the Docker container to just run the Habitica server and tests), then select "Checkout Windows-style, commit Unix-style line endings", or configure it by running

If you chose one setting now and later decide to change how you do your development work, you can use the appropriate  command to change the setting.

For further information on line endings and whitespace in Git, see the "Formatting and Whitespace" section in the Pro Git book.

If you don't want to set the  setting globally, see Dealing with line endings > Per-repository settings to learn how to set it for individual repositories. This will only be relevant to you if you are already using Git for other projects or will be using it for others in future.

Install Node and NPM
This section takes you through the process of installing node and npm.

When you install Node, a Node executable file will be installed on your system. It might be called either  or. All of the commands below assume it is called  but if you see errors saying that node does not exist, type   instead.

Note that the sample commands below are for reference only and might not contain the correct version of node or npm so be sure to adjust the commands as needed before you run them. The correct versions are


 * 1) Check that inappropriate versions of node and npm are not installed:


 * 1) *If that command shows that node is not installed, proceed to the next step.
 * 2) *If it shows that you have a version of node that is different than the required version, uninstall it. On Ubuntu, the commands to uninstall it are:


 * 1) Install the correct version of node for your Linux distribution using the source code or a binary distribution, or a package manager.
 * 2) *For Ubuntu, whose software repositories may run a few months behind the latest revisions, install NodeJS from an updated repository. For example, if Node 12 needed to be installed:


 * 1) *For CentOS 7, if Node 12 needed to be installed:


 * 1) Check that you installed node successfully and that it is the correct version:


 * 1) Installing node also installs npm. Check that that has been done and that the version is correct:


 * 1) *If you have any other version of npm, upgrade it to the correct version. For example, if npm 6 needed to be installed but you had a different version:

If you discovered that your Node executable file is called, create a link to the name   using this command: