首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Node【问题 01】gyp verb `which` failed Error: not found: python2

Node【问题 01】gyp verb `which` failed Error: not found: python2

原创
作者头像
yuanzhengme
发布2025-08-11 20:43:29
发布2025-08-11 20:43:29
2660
举报
文章被收录于专栏:WEBWEB

@TOC

1.问题 not found: python2

代码语言:bash
复制
# 1.添加Python27的安装路径到环境变量
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2

# 2.依然报错
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python E:\anaconda3\envs\python.EXE

查看原因:

代码语言:bash
复制
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node"

1.1 方案一【我的环境失败】

代码语言:bash
复制
# npm设置国内地址
npm config set registry https://registry.npm.taobao.org/
npm config get registry

首先确认node的版本跟node-sass的版本是匹配的 https://github.com/sass/node-sass

代码语言:bash
复制
# 查询node版本
node -v

# 查询结果
v14.17.0
代码语言:json
复制
{
    ...
    "node-sass": "4.14.1",
    "sass-loader": "8.0.2",
    ...
}

解决方法,原文链接:https://blog.csdn.net/manonggeerdan/article/details/121260754

代码语言:bash
复制
# 1.删除工程的node_modules文件夹
# 2.以管理员身份打开dos窗口
# 3.安装node-gyp
npm install -g node-gyp
# 4.安装windows-build-tools
npm install --global --production windows-build-tools

这里可能出现的问题:

Visual Studio Build Tools一直处于“Still waiting for installer log file…”状态:

代码语言:bash
复制
Status from the installers:
---------- Visual Studio Build Tools ----------
Still waiting for installer log file...
------------------- Python --------------------
Python 2.7.8 is already installed, not installing again.

【解决】不需要等待,直接ctrl+c停止,然后输入以下命令

代码语言:bash
复制
npm install --global --production windows-build-tools --vs2015

# 安装成功
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Python 2.7.8 is already installed, not installing again.

Now configuring the Visual Studio Build Tools..

All done!

+ windows-build-tools@5.2.2
updated 1 package in 114.042s

然后再执行npm install

1.2 方案二【成功】

直接下载安装,复制报错信息里的地址:

代码语言:bash
复制
Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node"
# 使用腾讯的云服务器进行下载
wget https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node

虽然很慢但是最终下载成功了!然后执行以下命令进行安装:

代码语言:bash
复制
npm i node-sass@4.14.1 --sass_binary_site=E:\yuanzheng-codebase\code-gitee-open\open_ruoyi_activiti\ruoyi-deploy\ -D
  • -D 标志表示将 node-sass 安装为开发依赖项。

网盘文件分享:

链接:https://pan.baidu.com/s/1u72IgICc6EAlT4gAAr1gzg?pwd=bflf

1.3 方案三【成功】

代码语言:bash
复制
npm i node-sass@4.14.1 --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ -D

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.问题 not found: python2
    • 1.1 方案一【我的环境失败】
    • 1.2 方案二【成功】
    • 1.3 方案三【成功】
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档