影评周公子 2025-07-29 17:45 采纳率: 98.5%
浏览 13

问题:如何解决zsh中执行playwright install时提示command not found?

在使用 Zsh 终端执行 `playwright install` 命令时,出现 `command not found` 错误,通常是因为系统未正确安装 Playwright CLI 或环境变量未配置妥当。首先需确认是否已全局安装 Playwright,可通过 `npm init playwright@latest` 进行安装。若已安装但命令仍不可用,检查 `node_modules/.bin` 是否包含在 `PATH` 环境变量中,或尝试使用 `npx playwright install` 代替。此外,Zsh 与 Bash 在环境变量加载方式上略有不同,需确保 Node.js 和 Playwright 的路径在 `~/.zshrc` 中正确配置并执行 `source ~/.zshrc`。最后,重启终端或运行 `hash -r` 可刷新命令缓存,解决命令未被识别的问题。
  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 创建了问题 7月29日