A continuación se muestra el error que recibo cuando intento generar un nuevo proyecto con JHipster:
gyp verb check python checking for Python executable "python2" in the PATH gyp verb `which` failed Error: not found: python2 gyp verb check python checking for Python executable "python" in the PATH gyp verb `which` succeeded python C:\Program Files\Python36\python.EXE gyp verb check python version `C:\Program Files\Python36\python.EXE -c "import platform; print(platform.python_version());"` returned: "3.6.4\r\n" gyp verb could not find "C:\Program Files\Python36\python.EXE". checking python launcher gyp verb could not find "C:\Program Files\Python36\python.EXE". guessing location gyp verb ensuring that file exists: C:\Python27\python.exe gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python36\python.EXE", you can set the PYTHON env variable.El resto es el stacktrace. Lo extraño es que tengo Python instalado y la variable de entorno también está configurada. Mi versión de Python es "Python 3.6.4". ¿Debo ejecutarlo en Python 2? ¿Es ese el caso?
Hay otra solución a este error:
node_modules .npm install --global windows-build-tools --save en su símbolo del sistema.npm install node-sass@4.12.0 --save (o la última versión) ¡Esto debería resolver el error y devolverle un mensaje gyp info ok !
Si encuentra que Node Sass could not find a binding for your current environment , resuélvalo ejecutando:
npm rebuild node-sass
Solo una nota para cualquiera que use React y enfrente el mismo error en Linux (Ubuntu):
Paso 1: Instalar Python 2.7
sudo apt update sudo apt install python2-minimalPaso 2: Instale make o simplemente build-essential
sudo apt-get install build-essentialLuego puede continuar con su actividad anterior...
Sí, node-gyp requiere Python 2.7, por lo que puede probar las respuestas a esta pregunta .
Alternativamente, si encuentra este problema, probablemente se deba a node-sass y si no seleccionó Sass en las opciones de JHipster, no lo necesita pero aún así lo obtiene porque es una dependencia transitiva de Angular, puede omitirlo estableciendo variables de entorno:
set SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true set SKIP_NODE_SASS_TESTS=trueOtra alternativa es utilizar JHipster devbox .