This article runs through in detail how to run the Gaia codebase locally, and what tools are available in this setup.
To start with, we should point out that you DON'T have to build Gecko, or B2G, to contribute to Gaia. You just need to download the Gaia source code and have the ability to run and edit it in some way.
There are several different ways to run Gaia:
- Flash your phone with an updated Gaia build.
- Run your Gaia inside WebIDE.
- Launch Gaia inside our Firefox Mulet tool for running Gaia on the Desktop.
You can find concise information on running it in these different ways on our Different ways to run Gaia page, along with links to more detailed information as required. In general these are ordered from most complex (but most realistic experience provided) to easiest (but least realistic).
In this article we'll be concentrating on running Gaia inside Firefox Mulet or in WebIDE — for most changes you'll want to make to the Gaia codebase, this offers the quickest mechanism for testing updates, but obviously there are some features (such as testing device APIs or interaction with phone hardware) that will need a real device.
Running your own Gaia build
Note: For a simpler, one shot build process, try the Foxbox tool. Windows users especially will benefit from this, as the regular Gaia build procedure doesn't work on a standard Windows environment.
- First, make a fork of the main Gaia repo on Github.
- Next, clone your fork locally:
git clone https://github.com/your-username/gaia.git
- Add the upstream like this:
cd gaia git remote add upstream https://github.com/mozilla-b2g/gaia
- Now you need to create a Gaia profile. Running
makeinside your repo folder creates a profile in the
profiledirectory, which is setup for optimal debugging.
- When your debug profile has been built, it will give you a message along the lines of "Profile Ready: please run [b2g|firefox] -profile /Users/chris/git/gaia/profile". Ignore this, and instead following the linked instructions to run it in Mulet or WebIDE.
Troubleshooting and known issues
Error: Python executable "python3" is v3.x, which is not supported by gyp.
On some Linux distributions (eg: Archlinux), the default
python3. This makes
npm fail when running some commands (eg. when running tests). To fix it once and for all, you can run the following command:
npm config set python python2
You can look at this Stack Overflow page for other solutions.
Then you should delete your
node_modules directory and run the failed command again.
Please Install NodeJS -- (use aptitude on linux or homebrew on osx)
So, you get this error although you think you installed it. Chances are you're running Debian or another Debian-based distribution like Ubuntu. On these distributions, NodeJS is contained in the
nodejs package, and you can install the
nodejs-legacy package to set up everything correctly:
sudo aptitude install nodejs-legacy
If you have issues installing this package, maybe you're using Chris Lea's PPA for Node; please remove it before moving forward.
Different gaia branches require different node versions; for instance if you previously built the v2.5 branch with node 0.10 and want to switch to the master branch, you may need to run something like:
nvm use 4.2 && rm -r node_modules && npm install --production