繁体   English   中英

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

[英]jhipster - gyp verb `which` failed Error: not found: python2

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

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

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

  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

是的 node-gyp 需要 Python 2.7,所以你可以尝试这个问题的答案。

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

set SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
set SKIP_NODE_SASS_TESTS=true

另一种选择是使用JHipster devbox

我也刚碰到这个。

我不得不更改为旧节点版本:

PS C:\> nvm list

    17.6.0
  * 16.13.2 (Currently using 64-bit executable)
    15.0.0
    10.19.0
PS C:\> nvm use 10.19.0
Now using node v10.19.0 (64-bit)

否则 package node-sass安装失败。 我没有进一步调查原因。

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

第一步:安装python 2.7

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

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

  • 就像是:
     sudo apt-get install build-essential

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM