Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

docs: complete macOS node-gyp troubleshooting steps in CONTRIBUTING.md #4036

Merged
merged 7 commits into from
Jun 21, 2023
Merged
32 changes: 26 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,40 @@

If installation fails due to a `node-gyp` issue you may need to perform some additional system configuration.

### on Linux (Ubuntu-based)

- Make sure `npm` commands are not run as `root`.
- If you get an error that `make` isn't installed you might need to also install the `build-essential` package
- example `sudo apt update && sudo apt install build-essential`
note: Ganache uses [node-gyp v7.1.2](https://github.com/nodejs/node-gyp/tree/v7.1.2) as part of its build system, which requires Python v2.7, v3.5, v3.6, v3.7, or v3.8 to be installed on the system.

### on Windows

- Install [https://www.npmjs.com/package/windows-build-tools](Windows-Build-Tools)
- `npm install --global windows-build-tools`

### on Linux (Ubuntu-based)

- Make sure `npm` commands are not run as `root`.
- If you get an error that `make` isn't installed you might need to also install the `build-essential` package
- example `sudo apt update && sudo apt install build-essential`
- Determine whether you have a compatible version of Python installed:
- example: `python --version` (and `python3 --version` if `python3` is installed)
- If you do not have a compatible version installed: (v2.7, v3.5, v3.6, v3.7, or v3.8), you will need to install it:
- example: `sudo apt update && sudo apt install python2.7`
- You may need to configure the python dependency (see [node-gyp for details on different ways to do this](https://github.com/nodejs/node-gyp/tree/v7.1.2#configuring-python-dependency)):
- example: `npm config set python <path-to-python-executable>`

### on macOS

- I have no idea.
- Attempt to install Xcode command line tools (the console will tell you if they're already installed)
- example: `xcode-select --install`
- Determine whether you have a compatible version of Python installed:
- example: `python --version` (and `python3 --version` if `python3` is installed)
- If you do not have a compatible version installed: (v2.7, v3.5, v3.6, v3.7, or v3.8), you will need to install it: (we recommend [pyenv](https://github.com/pyenv/pyenv) to manage your python installation)
1. [Install `pyenv`](https://github.com/pyenv/pyenv#homebrew-in-macos)
2. [Setup your shell environment for `pyenv`](https://github.com/pyenv/pyenv#set-up-your-shell-environment-for-pyenv)
3. Install Python: `pyenv install 2.7`
4. You may need to configure the python dependency (see [node-gyp for details on different ways to do this](https://github.com/nodejs/node-gyp/tree/v7.1.2#configuring-python-dependency)):
- example: `npm config set python <path-to-python-executable>`
- If the above steps don't fix the `node-gyp` issue and you've recently updated your OS, you may need to re-install Xcode command line tools:
1. Remove the existing, broken installation: `rm -rf /Library/Developer/CommandLineTools`
2. Install them again: `xcode-select --install`

## Clean install

Expand Down