gpt4 book ai didi

node.js - Heroku找不到Playwright文件

转载 作者:行者123 更新时间:2023-12-02 21:32:11 24 4
gpt4 key购买 nike

我的TypeScript NodeJS(> = 12.0.0)应用使用Playwright(^ 1.4.2)。它在本地运行良好。但是,它在Heroku上失败:

browserType.launch: Failed to launch chromium because executable doesn't exist at /app/.cache/ms-playwright/chromium-799411/chrome-linux/chrome

Try re-installing playwright with "npm install playwright"

Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.

at BrowserType._wrapApiCall (/app/node_modules/playwright/lib/client/channelOwner.js:78:15)

at BrowserType.launch (/app/node_modules/playwright/lib/client/browserType.js:49:21)

at Object.exports.browserTest (/app/utils.js:34:57)

at Object.<anonymous> (/app/index.js:13:9)

at Module._compile (internal/modules/cjs/loader.js:1076:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)

at Module.load (internal/modules/cjs/loader.js:941:32)

at Function.Module._load (internal/modules/cjs/loader.js:782:14)

at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
因此,我通过SSH进入了Heroku dyno,并运行了 npm install playwright。得到了同样的错误。
然后我想,如何将其构建到Docker镜像(node:latest)中,然后将其部署到Heroku?当然,这不会失败。它做了。同样的错误。该图像在本地完美运行。
根据在线解决方案,我还尝试安装了几个Heroku构建包,并专门使用了 ChromiumFirefox Playwright口味。然后,我尝试了我忘记的其他一千件事(编辑:包括 mxschmitt heroku-playwright-example)。
有人遇到过这个问题吗?

最佳答案

alterjun和MaxSchmitt指向github.com/mxschmitt/heroku-playwright-buildpack,它说buildpack很重要。我以前尝试过,但一定做错了,但现在可以了。

关于node.js - Heroku找不到Playwright文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64198107/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com