当我在react项目上运行
yarn create playwright --ct
时,出现以下错误;文档还说,运行该命令后会生成一些文件,但它们没有生成。
如有任何帮助,我们将不胜感激
bash: line 1: _modules.binplaywright: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command failed: yarn playwright install
at checkExecSyncError (node:child_process:871:11)
at execSync (node:child_process:943:15)
at executeCommands (\AppData\Local\Yarn\Data\global\node_modules\create-playwright\lib\index.js:4519:39)
at Generator.run (\AppData\Local\Yarn\Data\global\node_modules\create-playwright\lib\index.js:4660:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async \AppData\Local\Yarn\Data\global\node_modules\create-playwright\lib\index.js:4928:3 {
status: 127,
signal: null,
output: [ null, null, null ],
pid: 17900,
stdout: null,
stderr: null
}
error Command failed.
Exit code: 1
尝试删除node_modules并重新安装,但没有成功
另一种选择是手动安装:
# add playwright package
yarn add -E -D @playwright/test
# install supported browsers
ynpx playwright install
确保“ynpx”已全局安装,否则安装它。
yarn global add ynpx