When generating a Lighthouse report. It says "Can only auditpages on HTTP or HTTPs. Navigate to different page", What should I do?

Sanjh 0 Reputation points
2024-07-29T11:18:10.4966667+00:00

I can generate a Light House report. I need help

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,656 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pradeep M 3,600 Reputation points Microsoft Vendor
    2024-09-20T11:57:40.2533333+00:00

    Hi Sanjh

    The error message "Can only audit pages on HTTP or HTTPS" in Lighthouse indicates that you are trying to audit a page that is not served over HTTP or HTTPS. This typically happens if you're auditing a local file (file:// URL) or a different type of resource. 

    To resolve this: 

    1.Serve the page over HTTP/HTTPS:  

    If you're working on a local development project, use a local server to serve your files. You can use tools like:  

    VS Code Live Server extension: For quickly serving HTML files on your localhost. 

    Node.js: Using http-server or any other simple Node.js server. 

    Python: Run python -m http.server (or python3 -m http.server for Python 3) from your project folder. 

    2.Navigate to an HTTP/HTTPS page:  

    Make sure you are auditing a page that is hosted on the web, accessible via an http:// or https:// URL. 

    Check the URL:  

    If the page you’re auditing is using the file:// protocol, Lighthouse won't work. Ensure you are using the correct protocol (e.g., [http://localhost]). 

    If these steps are helpful, please click "Upvote" and "Accept Answer" on this post. 

    Thank you. 

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.