-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\****\Documents\Project\MI\PuppetScript\RetestStart\node_modules\lighthouse\lighthouse-core\fraggle-rock\api.js' #14791
Comments
Can you provide the script you are using? Oh, https://web.dev/lighthouse-user-flows/ is referring to pre-10.0 stuff. We need to update that. |
Hi Connor,
Please find the script below.
import fs from 'fs';
import open from 'open';
import puppeteer from 'puppeteer';
import lighthouse from 'lighthouse';
import {startFlow} from 'lighthouse/lighthouse-core/fraggle-rock/api.js';
async function captureReport() {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
const flow = await startFlow(page, {name: 'Single Navigation'});
await flow.navigate('https://web.dev/performance-scoring/');
await browser.close();
const report = await flow.generateReport();
fs.writeFileSync('flow.report.html', report);
open('flow.report.html', {wait: false});
}
captureReport();
|
@Darshan20231402 the location of the user flow api has changed in Lighthouse 10.0. To import it you can use |
Thank you @adamraine , I am able to startFlow by importing as suggested. const config = require('lighthouse/lighthouse-core/config/desktop-config.js'); |
Change Please look over the breaking changes section of 10.0 before continuing: https://github.com/GoogleChrome/lighthouse/releases/tag/v10.0.0 |
You can also do |
Thank you @connorjclark and @adamraine . Please find the script below:---- // const {getDocument, queries} = pptrTestingLibrary; (async () => {
})().catch(err => { |
It sounds like you want to test a desktop page but inherit whatever viewport changes you made with Puppeteer. The way you would set that up is: import {startFlow, desktopConfig} from 'lighthouse';
const flow = await startFlow(page, {
config: desktopConfig,
flags: {screenEmulation: {disabled: true}}
});
await page.setViewport({
width: 1263,
height: 556
}); |
Thank you @adamraine . It worked as expected. |
FAQ
URL
https://www.mi-perftest1.com/default.mi?phoenix=true
What happened?
I am trying to automate the lighthouse User flow `by integrating with Puppeteer script by referring to the article [https://web.dev/lighthouse-user-flows/]
I have performed all the required steps but still I am facing ERR_MODULE_NOT_FOUND error. Appreciate your help on this issue.
Error log:
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\dards\Documents\Project\MI\PuppetScript\RetestStart\node_modules\lighthouse\lighthouse-core\fraggle-rock\api.js' imported from C:\Users\dards\Documents\Project\MI\PuppetScript\RetestStart\index.js
at new NodeError (node:internal/errors:399:5)
at finalizeResolution (node:internal/modules/esm/resolve:326:11)
at moduleResolve (node:internal/modules/esm/resolve:945:10)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap. (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v18.14.0
What did you expect?
Need your help to fix the above explained issue.
What have you tried?
I am facing this issue with the lighthouse package
How were you running Lighthouse?
node
Lighthouse Version
10.0.0
Chrome Version
110.0.5481.77
Node Version
v18.14.0
OS
Windows
Relevant log output
The text was updated successfully, but these errors were encountered: