How to fix npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error in npm

npmBEGINNERMEDIUMUpdated Dec 6, 2025· 160 views

The "gyp ERR! find Python" error occurs when node-gyp cannot locate Python during native module compilation. Install Python 3.6+ and ensure it's in your PATH.

Quick fix

Fixes npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error

brew install python3
# Or download from python.org
  1. Install Python 3
  2. Verify Python is in PATH
  3. Configure npm to use Python
  4. Use NODE_GYP_FORCE_PYTHON
npm — error
brew install python3
# Or download from python.org
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error

What this error means

Node-gyp requires Python to compile native C++ modules. This error means Python is either not installed, not in your system PATH, or is an unsupported version (Python 2 is no longer supported; minimum is Python 3.6). The error typically appears when installing packages with native bindings like bcrypt, node-sass, sqlite3, or canvas.

Typical symptoms

  • npm install fails with "gyp ERR! find Python"
  • Error says "Can't find Python executable"
  • Message shows "version is 2.7 - should be >=3.6.0"
  • Native module packages fail to compile
  • Works on some machines but fails on others
  • Fails in CI/CD but works locally

Common causes

  1. Python is not installed
  2. Python is installed but not in system PATH
  3. Wrong Python version (Python 2.x or < 3.6)
  4. Multiple Python versions installed, wrong one found
  5. npm config points to wrong Python path
  6. Python installed but build tools missing

How to fix "npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error"

1Install Python 3

Install Python 3.6 or higher:

macOS:

bash
brew install python3
# Or download from python.org

Ubuntu/Debian:

bash
sudo apt-get update
sudo apt-get install python3 python3-pip

Windows:
Download from python.org and check "Add Python to PATH" during installation.

Alpine Linux:

bash
apk add python3
2Verify Python is in PATH

Check that Python is accessible:

bash
# Check Python version
python3 --version
# or
python --version

# Should show 3.6.0 or higher

If command not found, Python isn't in your PATH.

3Configure npm to use Python

Tell npm where to find Python:

bash
# Set Python path in npm config
npm config set python /usr/bin/python3

# Or use environment variable
export npm_config_python=/usr/bin/python3

# Windows example
npm config set python C:\Python39\python.exe

Note: npm v10+ may require environment variables instead of npm config.

4Use NODE_GYP_FORCE_PYTHON

Override all Python detection:

bash
# Force specific Python
export NODE_GYP_FORCE_PYTHON=/usr/bin/python3

# Then install
npm install

This takes precedence over npm config and other settings.

5Install additional build tools

Python alone isn't enough—you also need a C++ compiler:

macOS:

bash
xcode-select --install

Ubuntu/Debian:

bash
sudo apt-get install build-essential

Windows:
Install Visual Studio Build Tools with C++ workload.

6Clean and retry

After configuring Python:

bash
# Clear npm cache
npm cache clean --force

# Remove node_modules
rm -rf node_modules package-lock.json

# Reinstall
npm install

Advanced notes

Python version requirements:
- node-gyp v5+: Python 3.6+
- node-gyp v10+: Python 3.12 supported
- Python 2.x: No longer supported

For Docker images, ensure Python is installed in the build stage:

dockerfile
FROM node:18
RUN apt-get update && apt-get install -y python3 build-essential
COPY package*.json ./
RUN npm ci

If you have multiple Python versions, node-gyp searches in this order:
1. NODE_GYP_FORCE_PYTHON env var
2. npm config python setting
3. PYTHON env var
4. System PATH

Frequently asked questions

What does "npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error" mean?
Node-gyp requires Python to compile native C++ modules. 6). The error typically appears when installing packages with native bindings like bcrypt, node-sass, sqlite3, or canvas.
How do I fix "npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error"?
The "gyp ERR! find Python" error occurs when node-gyp cannot locate Python during native module compilation. Install Python 3.6+ and ensure it's in your PATH.
What causes "npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error"?
Python is not installed Python is installed but not in system PATH Wrong Python version (Python 2.x or < 3.6)
Is the "npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading