npm:项目安装失败 Can't find Python executable "python", you can set the PYTHON env var

169 阅读1分钟

错误截图:

1.png

主要矛盾:node与node-sass版本不匹配

问题详细信息:

项目中依赖的node-sass很可能已经不兼容新的node,对应版本兼容如下(或参考官方仓库):

  1. Supported Node.js versions vary by release, please consult the releases page.
  2. Node versions that hit end of life github.com/nodejs/Rele…, will be dropped from support at each node-sass release (major, minor).
  3. We will stop building binaries for unsupported releases, testing for breakages in dependency compatibility, but we will not block installations for those that want to support themselves.
  4. New node release require minor internal changes along with support from CI providers (AppVeyor, GitHub Actions). We will open a single issue for interested parties to subscribe to, and close additional issues.

Below is a quick guide for minimum and maximum supported versions of node-sass:

NodeJSSupported node-sass versionNode Module
Node 177.0+102
Node 166.0+93
Node 155.0+, <7.088
Node 144.14+83
Node 134.13+, <5.079
Node 124.12+72
Node 114.10+, <5.067
Node 104.9+, <6.064
Node 84.5.3+, <5.057
Node <8<5.0<57

解决方法:

将node版本切换到node10.24.1,安装成功。