记一次vue安装模块报 gyp ERR! find Python

在vscode终端安装模块报以下错误,后来在win自带powershell里安装包顺利完成!

│ Building: C:\Program Files\nodejs\node.exe D:\aaa\vue_h5\node_modules\.pnpm\node-gyp@8.4.1\node_modules\node-gyp\bin\node-gyp.js rebuild --verbos  
│ gyp info it worked if it ends with ok
│ gyp verb cli [
│ gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
│ gyp verb cli   'D:\\aaa\\vue_h5\\node_modules\\.pnpm\\node-gyp@8.4.1\\node_modules\\node-gyp\\bin\\node-gyp.js',
│ gyp verb cli   'rebuild',
│ gyp verb cli   '--verbose',
│ gyp verb cli   '--libsass_ext=',
│ gyp verb cli   '--libsass_cflags=',
│ gyp verb cli   '--libsass_ldflags=',
│ gyp verb cli   '--libsass_library='
│ gyp verb cli ]
│ gyp info using node-gyp@8.4.1
│ gyp info using node@14.21.2 | win32 | x64
│ gyp verb command rebuild []
│ gyp verb command clean []
│ gyp verb clean removing "build" directory
│ gyp verb command configure []
│ gyp verb find Python Python is not set from command line or npm configuration
│ gyp verb find Python Python is not set from environment variable PYTHON
│ gyp verb find Python checking if "python3" can be used
│ gyp verb find Python - executing "python3" to get executable path
│ gyp verb find Python - "python3" is not in PATH or produced an error
│ gyp verb find Python checking if "python" can be used
│ gyp verb find Python - executing "python" to get executable path
│ gyp verb find Python - "python" is not in PATH or produced an error
│ gyp verb find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe
│ gyp verb find Python - executing "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe" to get version
│ gyp verb find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe" could not be run
│ gyp verb find Python checking if Python is C:\Program Files\Python39\python.exe
│ gyp verb find Python - executing "C:\Program Files\Python39\python.exe" to get version
│ gyp verb find Python - "C:\Program Files\Python39\python.exe" could not be run
│ gyp verb find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python39-32\python.exe
│ gyp verb find Python - executing "C:\Users\Administrator\AppData\Local\Programs\Python\Python39-32\python.exe" to get version
│ gyp verb find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
│ gyp verb find Python checking if Python is C:\Program Files\Python39-32\python.exe
│ gyp verb find Python - executing "C:\Program Files\Python39-32\python.exe" to get version
│ gyp verb find Python - "C:\Program Files\Python39-32\python.exe" could not be run
│ gyp verb find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
│ gyp verb find Python - executing "C:\Program Files (x86)\Python39-32\python.exe" to get versi
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
这个错误表明你的项目依赖项中的某个模块(deasync)需要使用 Python 来构建,但是无法找到可用的 Python 环境。解决这个问题的方法是设置正确的 Python 环境。 首先,确保你的计算机上已经安装Python,并且它已经添加到了系统的环境变量中。你可以在命令行中运行 `python --version` 来验证 Python 是否正确安装并可用。 如果你已经安装Python,但仍然收到错误消息,那么可能是因为 Python 的路径没有正确配置。你可以手动设置 `PYTHON` 环境变量,指向你的 Python 安装目录。在 Windows 中,按照以下步骤进行设置: 1. 打开控制面板,并进入“系统和安全” > “系统”。 2. 在左侧导航栏中,点击“高级系统设置”。 3. 在弹出的窗口中,点击“环境变量”按钮。 4. 在“系统变量”部分,查找名为 `PYTHON` 的变量,如果不存在则点击“新建”来创建它。 5. 将变量值设置为你的 Python 安装目录的路径(例如 `C:\Python39`)。 6. 点击“确定”保存更改并关闭窗口。 完成以上步骤后,重新运行 `npm install` 命令,应该可以解决问题。如果仍然遇到相同的错误,请确保你的 Python 安装正确,并且路径设置正确。 如果问题仍然存在,你可以尝试使用不需要依赖 Python 的替代模块,或者在项目中手动删除对 `deasync` 模块的依赖。 希望这些信息能够帮助你解决问题!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值