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.