Open zsharp-gls opened 1 year ago
Seconded. I am also running into the same issue.
I attempted to manually modify the lighthouse
line in the node_modules
directory to the following and that seemed to allow bun
to run lighthouse
.
function getRuntimeFunctionName(fn) {
if (!fn.name) throw new Error(`could not find function name for: ${fn}`);
return fn.name;
}
This approach uses the name property of the function object, which should be more reliable than parsing the function's string representation.
However, I am wondering if there is a way to modify the bun
runtime configuration or the tsconfig.json
to work with lighthouse
as is.
Is this a bug related to lighthouse or bun?
I believe one of bun's goals is to be a drop-in replacement for node.js. This is an instance where it isn't (because Lighthouse is doing something outside of the norm). So, I could see it being resolved from either end
This seems to work fine now? I can run lighthouse with bun 1.1.32
I just receive this error after finishing the run: LH:ChromeLauncher:warn Chrome could not be killed The value of "pid" is out of range. It must be a positive integer. Received -38211
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
bun add lighthouse
index.ts
script to run lighthouseconst result = await lighthouse("https://google.com", { disableStorageReset: true });
console.log(result);
'function truncate(string, characterLimit) { return Util.truncate(string, characterLimit); }'
error: could not find function name for: function(string, characterLimit) { return Util.truncate(string, characterLimit); }
function(string, characterLimit) { return Util.truncate(string, characterLimit); }