【问题标题】:jhipster - gyp verb `which` failed Error: not found: python2jhipster - gyp动词`which`失败错误:未找到:python2
【发布时间】:2018-08-04 14:48:18
【问题描述】:

以下是我尝试使用 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 中运行它吗?是这样吗?

【问题讨论】:

    标签: python jhipster


    【解决方案1】:

    是的 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

    【讨论】:

      【解决方案2】:

      我也遇到了这个问题。

      【讨论】:

      • 这似乎在 2021 年仍然适用于相当最新的安装和软件包版本。不知道为什么根本问题没有得到解决。
      【解决方案3】:

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

      1. 删除您的node_modules 文件夹。
      2. 在命令提示符下运行 npm install --global windows-build-tools --save
      3. 使用命令安装node-sass:npm install node-sass@4.12.0 --save(或最新版本)

      这应该可以解决错误并向您返回gyp info ok 消息!

      如果遇到Node Sass could not find a binding for your current environment,运行解决:

      npm rebuild node-sass

      【讨论】:

        【解决方案4】:

        对于在 Linux (Ubuntu) 上使用 React 并遇到相同错误的任何人,请注意:

        第 1 步:安装 python 2.7

        • 类似的东西
           sudo apt update
           sudo apt install python2-minimal
          

        第 2 步:安装 make 或只是 build-essential

        • 类似:
          sudo apt-get install build-essential
          

        然后您可以继续之前的活动...

        【讨论】:

          猜你喜欢
          • 2022-07-22
          • 1970-01-01
          • 1970-01-01
          • 2019-01-12
          • 1970-01-01
          • 1970-01-01
          • 2018-10-24
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多