Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

6.7K
Views
Error de NPM "No se puede encontrar el ejecutable de Python" en MacOS Big Sur

He estado buscando la respuesta a esto durante una buena semana, sin éxito. Revisé todas las publicaciones de StackOverflow, todos los artículos de Google y todos los problemas relacionados con Github que pude encontrar. La mayoría de los errores relacionados parecen ser más antiguos, por lo que me pregunto si mi problema es un poco diferente debido a que estoy en macOS Big Sur.

El problema: cuando intento ejecutar yarn install en mi repositorio local, recibo un error relacionado con node-gyp y un ejecutable de python que no se puede encontrar. Esto es lo que muestra mi terminal:

 yarn install v1.22.17 ...other stuff [4/4] 🔨 Building fresh packages... [6/13] ⠐ node-sass [2/13] ⠐ node-sass [10/13] ⠐ metrohash [4/13] ⠐ fsevents error /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash: Command failed. Exit code: 1 Command: node-gyp rebuild Arguments: Directory: /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash Output: gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@12.18.0 | darwin | x64 gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "/usr/local/opt/python@3.9/bin/python3", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/node-gyp/lib/configure.js:484:19) gyp ERR! stack at PythonFinder.<anonymous> (/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/node-gyp/lib/configure.js:406:16) gyp ERR! stack at F (/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/which/which.js:68:16) gyp ERR! stack at E (/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/which/which.js:80:29) gyp ERR! stack at /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/which/which.js:89:16 gyp ERR! stack at /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/isexe/index.js:42:5 gyp ERR! stack at /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/isexe/mode.js:8:5 gyp ERR! stack at FSReqCallback.oncomplete (fs.js:167:21) gyp ERR! System Darwin 20.6.0 gyp ERR! command "/Users/jimmiejackson/.nvm/versions/node/v12.18.0/bin/node" "/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash/node_modules/.bin/node-gyp" "rebuild" gyp ERR! cwd /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash

No estoy completamente seguro de qué significa este error o por qué este módulo de nodo está buscando python3. Intenté ejecutar npm set config /path/to/python , descargar python3, configurar la ruta de PYTHON en mi perfil .zshrc, pero nada parece funcionar. Es muy posible que mi falta de comprensión del problema signifique que estoy en el camino correcto pero que no hice nada bien . ¿Algunas ideas?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Desde los mensajes de la terminal, está instalando una versión anterior de node-gyp (node-gyp@3.8.0). De una búsqueda rápida, parece que esta versión requiere Python 2. Python 2 debería estar presente en Big Sur . Establecer correctamente la ruta, debería funcionar:

 export PATH=/usr/bin/python:$PATH

Intenta también:

 export PYTHON=/usr/bin/python
over 4 years ago · Santiago Trujillo Report

0

Creo que puede definir explícitamente env var prefijándolo con npm_config :

 $ export npm_config_python=/path/to/python

verifique si eso está configurado enumerando la configuración:

 $ npm config list ... ; environment configs python = "/path/to/python"

esto debe ser recogido por node-gyp .

Otro enfoque sería definirlo en .npmrc

 python = "/path/to/python"

Un tercer enfoque sería configurarlo globalmente:

 npm config --global set python /path/to/python
over 4 years ago · Santiago Trujillo Report

0

Leer la fuente gyp-node podría ayudar. Aquí hay algunos pasos que puede probar.

  1. Instalar python2. Debe asegurarse de que en la terminal, which -a python2 solo devuelve un python2 y python2 -V devuelve la versión 2.x correcta.

  2. anula el entorno de PYTHON . export PYTHON=python2 .

  3. Vuelva a ejecutar la instalación.

Si todavía hay un error, probablemente el mensaje de error sea diferente.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!