-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Nuxt 3 Integration] Adding Unlighthouse to a Nuxt 3 project causes it to crash #13
Comments
Hey @Redemption198 Thanks for taking the time to make this issue and looking into it. I've identified the issue and pushed up a fix in 0.3.22. Please let me know if you have anymore issues :) |
Thank you for the quick fix, it works perfectly now! And also for creating this awesome tool! Would it be possible to only throw a warning when the CHROME_PATH variable isn't set? Maybe displaying a message saying that unlighthouse requires Chrome to work and is disabled until installed. |
There should already be handling for this case, see: https://github.com/harlan-zw/unlighthouse/blob/main/packages/core/src/resolveConfig.ts#L90 It uses https://github.com/GoogleChrome/chrome-launcher first, which uses the CHROME_PATH variable I guess? If that fails, it tries to find a logger.fatal('Failed to find a chrome / chromium binary to run. Add the puppeteer dependency to your project to resolve.', e)
logger.info('Run the following: \`npm install -g puppeteer\`')
process.exit(0) Is there a reliable way to bypass this? |
The CHROME_PATH error was: I was getting the error because I'm on a fresh install of Linux and didn't have any chrome/chromium browser installed, I tried installing ungoogled chromium but it didn't recognize it, while installing regular chrome from the rpm repository works fine. Now I'm facing new errors, I had to force a fresh installation of Nuxt due to the RC0 release. (Installing each package manually "fixes" the issue) If instead I use |
Installing Unlighthouse following the instructions causes the Nuxt server to crash. It is probably caused by a dependency issue, installing unlighthouse adds the
std-env@^2.3.0
package required by@nuxt/cli@^2.15.8
and@nuxt/config@2.15.8
which can't be installed on a Nuxt 3 project (Nuxt 3 usesstd-env@^3.x.x
). I can't provide a reproduction on codesandbox or stackblitz because the CHROME_PATH variable can't be set.The error:
[worker reload] [worker init] Named export 'isWindows' not found. The requested module 'file:///home/user/Documents/folder/project-dir/node_modules/std-env/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'file:///home/user/Documents/folder/project-dir/node_modules/std-env/index.js';
const { provider, isWindows } = pkg;
import { provider, isWindows } from 'node_modules/std-env/index.js';
^^^^^^^^^
SyntaxError: Named export 'isWindows' not found. The requested module 'node_modules/std-env/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'node_modules/std-env/index.js';
const { provider, isWindows } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:127:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:193:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
The text was updated successfully, but these errors were encountered: