以下是当我尝试使用 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.
剩下的就是堆栈跟踪。奇怪的是我确实安装了 python 并且还设置了环境变量。我的Python版本是“Python 3.6.4”。我应该在 Python 2 中运行它吗?是这样吗?
是的,node-gyp 需要 Python 2.7,所以你可以尝试以下答案这个问题 https://stackoverflow.com/questions/20454199/how-to-use-a-different-version-of-python-during-npm-install.
或者,如果你遇到这个问题,可能是由于node-sass造成的,如果你没有在JHipster选项中选择Sass,你不需要它,但你仍然得到它,因为它是来自Angular的传递依赖,你可以跳过它通过设置环境变量:
set SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
set SKIP_NODE_SASS_TESTS=true
另一种选择是使用JHipster 开发盒 https://github.com/jhipster/jhipster-devbox.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)