下面是我尝试使用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.


剩下的就是stacktrace。奇怪的是我确实安装了python并且还设置了环境变量。我的python版本是“ Python 3.6.4”。我应该在Python 2中运行它吗?是这样吗

最佳答案

是的,node-gyp需要Python 2.7,因此您可以尝试对this question的答案。

或者,如果遇到此问题,则可能是由于node-sass引起的,并且如果未在JHipster选项中选择Sass,则不需要它,但仍然可以得到它,因为它是Angular的传递依赖项,可以跳过它通过设置环境变量:

set SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
set SKIP_NODE_SASS_TESTS=true


另一种选择是使用JHipster devbox

07-25 21:51
查看更多