chrome-launcher wont launch

It's kind of outside t3 scope but im hoping i can get some help here - the error is happening in my t3 app I'm using node to run lighthouse and chrome launcher wont launch in my dev env (mac monterey), with a t3 app It seems like there's something wrong with the dependency - (but typescript compiles) I think maybe it cant find chrome? But google chrome at /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome which google-chrome returns not found
import ChromeLauncher from "chrome-launcher";

const chromeOptions = {
chromeFlags: ["--headless", "--disable-gpu"],
};

async function launchChrome() {
try {
const chrome = await ChromeLauncher.launch(chromeOptions);
console.log("chrome running!");
return chrome;
} catch (e) {
console.log("**** Chrome failed to launch", e);
debugger; // always land here.
throw e;
}
}
import ChromeLauncher from "chrome-launcher";

const chromeOptions = {
chromeFlags: ["--headless", "--disable-gpu"],
};

async function launchChrome() {
try {
const chrome = await ChromeLauncher.launch(chromeOptions);
console.log("chrome running!");
return chrome;
} catch (e) {
console.log("**** Chrome failed to launch", e);
debugger; // always land here.
throw e;
}
}
error:
**** Chrome failed to launch TypeError: Cannot read properties of undefined (reading 'launch')
at launchChrome (webpack-internal:///(api)/./src/server/reporting/lighthouseRunner.ts:35:84)
**** Chrome failed to launch TypeError: Cannot read properties of undefined (reading 'launch')
at launchChrome (webpack-internal:///(api)/./src/server/reporting/lighthouseRunner.ts:35:84)
I tried: - Adding this to my env CHROME_PATH="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
- Adding and removing chrome-launcher from package.json dependancies, deleting node_modules and reinstalling all "chrome-launcher": "^0.15.1",
- Making a symlink from Google\ Chrome to google-chrome (it wouldn't run from the terminal) - Copying Google\ Chrome to google-chrome, now it's in the path and launches with a warning (below) but chrome-launcher still doesnt launch ``` $ google-chrome [41560:259:0321/104228.826676:ERROR:keychain_password_mac.mm(103)] Keychain lookup failed: Error Domain=NSOSStatusErrorDomain Code=-25293 "errKCAuthFailed / errSecAuthFailed: / Authorization/Authentication failed." (-25293) Opening in existing browser session.
1 Reply
fotoflo
fotofloOP2y ago
0 so strange, it worked when i switched to require const chromeLauncher = require("chrome-launcher"); I wonder why.
Want results from more Discord servers?
Add your server