facebook / memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots
https://facebook.github.io/memlab/
MIT License
4.3k stars 116 forks source link

Could not find Chrome (ver. 121.0.6167.85). This can occur if either 1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or 2. your cache path is incorrectly configured #111

Closed susakin closed 5 months ago

susakin commented 5 months ago

你好 我在docker nodejs应用 里面去执行 memlab的方法, const { leaks, runResult } = await run({ scenario }); const steps = runResult.getInteractionSteps(); let memoryInfo = { leaks: JSON.stringify(leaks), heapSizeBase: steps?.[0]?.JSHeapUsedSize, heapSizeOpen: steps?.[1]?.JSHeapUsedSize, heapSizeClose: steps?.[2]?.JSHeapUsedSize, }; 他会报 Could not find Chrome (ver. 121.0.6167.85). This can occur if either

you did not perform an installation before running the script (e.g. npx puppeteer browsers install chrome) or your cache path is incorrectly configure 我看了之前有人提的issue 这个--chromium-binary 是不是可以解决这个问题,但是 这个命令只作用于 命令行,我翻看了 run方法的文档没有看到相关的api,英文不是很好 麻烦了

JacksonGL commented 5 months ago

I solved this problem, I found that I need to install in the puppeteer folder in node_module under global memlab

According to the answer in #90, consider installing npm install puppeteer inside node_module. When I get a chance, I will add a new option to specify the Chromium file path

参考一下 #90 的方法,可以试试写一个脚本 cd 到 node_module 的 puppeteer 文件夹安装 chromium 之后有时间会加一个 Chromium file path option

susakin commented 5 months ago

thx
谢谢老哥 我试试看

cgxdd commented 1 month ago

你好,请问你解决了吗?我也遇到相同的问题了 image

项目根目录下的.cache 文件夹下的内容 image

JacksonGL commented 1 month ago

@cgxdd If the environment variable PUPPETEER_SKIP_CHROMIUM_DOWNLOAD is set to false, running npm install puppeteer will not install Chromium. To verify if Puppeteer downloaded the Chromium binary, check the node_modules directory of your global npm installation. Alternatively, navigate to the local node_modules/puppeteer directory and run npm install.

如果环境变量 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 设置为 false,npm install puppeteer 不会在node_modules/puppeteer 安装 Chromium。可以检查global npm 安装的 node_modules 目录,看看 Puppeteer 是否已经下载了 Chromium。或者你也可以试试 cd 进入本地或者 global node_modules/puppeteer 目录并运行 npm install 安装Chromium。