Setting up Habitica Locally on Linux

== Set Up a Swap File==
If your computer does not have much RAM, it is likely that you will need a swap file of at least 4 GB, otherwise you will have persistent errors when running the "npm install" and "npm start" commands (for examples of errors, see this GitHub issue). If you have a relatively new computer with good RAM, you can probably ignore this section.
Your computer might already have a swap file. Find appropriate instructions on the internet for viewing or creating a swap file for your platform.
If you have a swap file but still cannot run the "npm install" and "npm start" commands successfully, try increasing the size of the swap file.
Record the size of your swap file now. If you later need to ask for help, include it in the troubleshooting information if you give us.
==Install Build Tools==
Command-line tools for building software such as make and gcc will be used by packages that you will be installing in later steps on this page. It is possible that your Linux box already has them installed so the commands below might tell you that nothing needs to be installed; that will not be an error and you can continue with the next section on this page.
For Ubuntu, Debian, and distributions based on them, run:sudo apt-get install build-essential
For RedHat, CentOS, and similar distributions, run:sudo yum install gcc-c++ make.
For any other distribution, if installing tools to build software from source seems necessary, consult the distribution's documentation to find out how.
==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 node or nodejs. All of the commands below assume it is called node but if you see errors saying that node does not exist, type nodejs 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 
#Check that inappropriate versions of node and npm are not installed:node --version; npm --version
#*If that command shows that node is not installed, proceed to the next step.
#*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:sudo apt-get purge nodejs -y; sudo apt-get purge node -y
#Install the correct version of node for your Linux distribution using the source code or a binary distribution, or a package manager.
#*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:curl --location https://deb.nodesource.com/setup_12.x | sudo bash -sudo apt-get install nodejs
#*For CentOS 7, if Node 12 needed to be installed:curl --location https://rpm.nodesource.com/setup_12.x | sudo bash -sudo yum install -y nodejs
#Check that you installed node successfully and that it is the correct version:node --version
#Installing node also installs npm. Check that that has been done and that the version is correct:npm --version
#*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:sudo npm install -g npm@6
If you discovered that your Node executable file is called nodejs, create a link to the name node using this command:sudo ln -s `which nodejs` /usr/bin/node
zh:在Linux本地搭建Habitica
Category:Contributing