问题描述
在Windows 11环境下使用Cursor IDE时,调用终端会失败,错误信息为:
"C:\\WINDOWS\\System32\\WindowsPowerShell\\1.0\\powershell.exe -i"已终止,退出代码: 1
原因分析
- Windows 11默认安装的是Windows PowerShell 5.1版本
- Cursor IDE与旧版PowerShell的集成存在兼容性问题
- 这个问题在社区中比较常见,特别是在Windows环境下
解决方法
- 升级到PowerShell 7.5(最新稳定版)
winget install --id Microsoft.PowerShell --source winget
如果升级失败,提示InternetOpenUrl() failed.
建议使用国内镜像
winget source remove winget
正在删除源: winget...
winget source add winget https://mirrors.ustc.edu.cn/winget-source
正在添加源: