You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Playwright浏览器安装失败求助:npx playwright install执行报错

Playwright初始化失败问题

问题详情

我是Playwright新手,在项目中初始化Playwright时,VS Code命令和控制台命令均执行失败。运行npx playwright install时出现如下错误日志:

0 verbose cli /opt/homebrew/Cellar/node/22.5.1/bin/node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js
1 info using npm@10.8.2
2 info using node@v22.5.1
3 silly config load:file:/opt/homebrew/lib/node_modules/npm/npmrc
4 silly config load:file:/Users/rostyslavpopov/WorkProjects/playwright/.npmrc
5 silly config load:file:/Users/rostyslavpopov/.npmrc
6 silly config load:file:/opt/homebrew/etc/npmrc
7 verbose title npm exec playwright install
8 verbose argv "exec" "--" "playwright" "install"
9 verbose logfile logs-max:10 dir:/Users/rostyslavpopov/.npm/_logs/2024-07-28T13_20_13_157Z-
10 verbose logfile /Users/rostyslavpopov/.npm/_logs/2024-07-28T13_20_13_157Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly logfile done cleaning log files
13 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
14 verbose stack Error: could not determine executable to run
14 verbose stack     at getBinFromManifest (/opt/homebrew/lib/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js:17:23)
14 verbose stack     at exec (/opt/homebrew/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:202:15)
14 verbose stack     at async Npm.exec (/opt/homebrew/lib/node_modules/npm/lib/npm.js:207:9)
14 verbose stack     at async module.exports (/opt/homebrew/lib/node_modules/npm/lib/cli/entry.js:74:5)
15 verbose pkgid playwright@1.0.0
16 error could not determine executable to run
17 verbose cwd /Users/rostyslavpopov/WorkProjects/playwright
18 verbose os Darwin 23.5.0
19 verbose node v22.5.1
20 verbose npm  v10.8.2
21 verbose exit 1
22 verbose code 1
23 error A complete log of this run can be found in: /Users/rostyslavpopov/.npm/_logs/2024-07-28T13_20_13_157Z-debug-0.log

当前我的node_modules目录为空,不确定是否属于正常情况。

已尝试的解决方法

  • 删除node_modules后重新执行命令
  • 尝试删除git钩子(实际不存在该文件)

以上操作均未解决问题。

内容的提问来源于stack exchange,提问作者Rostyslav Popov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 13:49:58