当前位置: 首页 > article >正文

npm install报错,gyp verb `which` failed Error: not found: python

主要错误

gyp verb which failed Error: not found: python2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! node-sass@4.14.1 postinstall: node scripts/build.js
全部错误

gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21) {
gyp verb `which` failed   stack: 'Error: not found: python2\n' +
gyp verb `which` failed     '    at getNotFoundError (D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\which\\which.js:13:12)\n' +
gyp verb `which` failed     '    at F (D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\which\\which.js:68:19)\n' +
gyp verb `which` failed     '    at E (D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\which\\which.js:80:29)\n' +
gyp verb `which` failed     '    at D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\which\\which.js:89:16\n' +
gyp verb `which` failed     '    at D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\isexe\\index.js:42:5\n' +
gyp verb `which` failed     '    at D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\isexe\\windows.js:36:5\n' +
gyp verb `which` failed     '    at FSReqCallback.oncomplete (fs.js:158:21)',
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21) {
gyp verb `which` failed   stack: 'Error: not found: python\n' +
gyp verb `which` failed     '    at getNotFoundError (D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\which\\which.js:13:12)\n' +
gyp verb `which` failed     '    at F (D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\which\\which.js:68:19)\n' +
gyp verb `which` failed     '    at E (D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\which\\which.js:80:29)\n' +
gyp verb `which` failed     '    at D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\which\\which.js:89:16\n' +
gyp verb `which` failed     '    at D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\isexe\\index.js:42:5\n' +
gyp verb `which` failed     '    at D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\isexe\\windows.js:36:5\n' +
gyp verb `which` failed     '    at FSReqCallback.oncomplete (fs.js:158:21)',
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". 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 "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at callback (D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\graceful-fs\polyfills.js:306:20)
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.22631
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\small software\\developer\\OpenSourceProjects\\book-v2.0\\sq-ui\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\small software\developer\OpenSourceProjects\book-v2.0\sq-ui\node_modules\node-sass
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN sass-loader@10.1.0 requires a peer of sass@^1.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@10.1.0 requires a peer of fibers@>= 3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-loader@2.2.1 requires a peer of eslint@>=1.6.0 <7.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sy-sqw\AppData\Roaming\npm-cache\_logs\2024-09-15T08_49_59_575Z-debug.log

解决:

node-sass 问题

node-sass版本需与node版本对应,如下
在这里插入图片描述
可在项目根目录文件package.json中查看node-sass版本,没有请忽略

  "devDependencies": {
    "node-sass": "4.14.1",
    "sass-loader": "10.1.0"
  },

设置镜像

// 设置国内npm镜像地址
npm config set registry http://registry.npmmirror.com
// 查询npm配置
npm config list

安装编译环境

npm install -g node-gyp
// 在 Windows 上?想要编译原生 Node 模块吗?使用这一行安装构建工具。以管理员身份启动 PowerShell 并运行
npm install --global --production windows-build-tools

https://www.npmjs.com/package/windows-build-tools

卸载安装失败的包,重新安装

npm uninstall node-sass
npm install sass -i

最后

npm install

http://www.kler.cn/a/305859.html

相关文章:

  • 策略模式、状态机详细解读
  • Zookeeper的安装与使用
  • Linux——GPIO输入输出裸机实验
  • C语言入门到精通(第六版)——第十六章
  • Spring Boot中的自动装配机制
  • 阅读2020-2023年《国外军用无人机装备技术发展综述》笔记_技术趋势
  • 第十六节:学习Springboot 的自定义资源路径(自学Spring boot 3.x的第四天)
  • 鸿蒙之Hello Word 遇坑总结 mac系统 不能预览 提示 Only files in a module can be previewed 解决办法
  • [Mdp] lc3290. 最高乘法得分(二维dp+状态定义+状态转移+LCS问题+好题+周赛415_2)
  • 网络原理(3)—— 应用层、传输层(TCP)
  • ArcGIS Pro SDK (十三)地图创作 4 设备
  • Qt 学习第十天:标准对话框 页面布局
  • Windows11 WSL2的ubuntu 22.04中拉取镜像报错
  • 分贝转换 1 mVpp = 9.03dBmV
  • 【软考】设计模式之抽象工厂模式
  • Linux通配符*、man 、cp、mv、echo、cat、more、less、head、tail、等指令、管道 | 、指令的本质 等的介绍
  • 重修设计模式-创建型-建造者模式
  • 基于YOLOv8的遥感光伏板检测系统
  • Vite + Electron 时,Electron 渲染空白,静态资源加载错误等问题解决
  • mysql的监控指标采集
  • 机器学习-------数据标准化
  • 一键生成中秋国风插画!FLUX中秋专属Lora的使用教程
  • 随着Batch size增加,最佳learning rate如何选择?
  • 一个关于Excel的段子
  • 2860. 让所有学生保持开心的分组方法数
  • 模板替换引擎(支持富文本动态表格)