jhipster-gyp动词`which`失败错误:未找到:python2

jhipster-gyp动词`which`失败错误:未找到:python2,python,jhipster,Python,Jhipster,以下是我尝试使用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` succe

以下是我尝试使用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版本是“Python3.6.4”。我应该在Python 2中运行它吗?是这样吗?

是的,节点gyp需要Python2.7,因此您可以尝试回答

或者,如果您遇到此问题,可能是由于节点sass造成的,如果您没有在JHipster选项中选择sass,您不需要它,但仍然可以得到它,因为它是Angular的可传递依赖项,您可以通过设置环境变量跳过它:

set SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
set SKIP_NODE_SASS_TESTS=true

另一种选择是使用。

我也遇到了这个问题

  • 我必须安装Python2.7

  • 我还需要将我的节点版本降级到6.16[链接到如何安装和卸载]()


此错误还有另一种解决方法:

  • 删除您的
    节点\u模块
    文件夹
  • 在命令提示符下运行
    npm install--global windows build tools--save
  • 使用以下命令安装节点sass:
    npm Install node-sass@4.12.0--保存
    (或最新版本)
  • 这将解决错误并返回一条
    gyp info ok
    消息

    如果遇到
    节点,Sass无法找到当前环境的绑定
    ,请通过运行以下命令解决此问题:


    npm重建节点sass

    在2021年,这似乎仍然适用于最新的安装和软件包版本。不确定为什么根本问题没有得到解决。