ReferenceError: URL is not defined
See original GitHub issueGetting this error in my CI after updating to version 5.0.0, I think it has to do something with 94800e160b9510e31d3a7f459da81991e500fe9e
/usr/lib/node_modules/lighthouse/lighthouse-core/lib/url-shim.js:35
class URLShim extends URL {
^
ReferenceError: URL is not defined
at Object.<anonymous> (/usr/lib/node_modules/lighthouse/lighthouse-core/lib/url-shim.js:35:23)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/node_modules/lighthouse/lighthouse-core/lib/network-request.js:14:13)
at Module._compile (module.js:652:30)
child_process.js:644
throw err;
Provide the steps to reproduce
lighthouse --chrome-flags=“–disable-gpu --headless --no-sandbox” https://google.com --output json --output html --output-path ./.lighthouse/google.com_05-09-19-1557389996769.json
Environment Information
- Affected Channels: CLI
- Lighthouse version: 5.0.0
- Node.js version: 8.11.1
- Operating System: Ubuntu 17.10
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
URL is not defined in node.js - Stack Overflow
Try to add this line: var URL = require('url').URL;. The full example is here: var URL = require('url').URL; var myURL = new ...
Read more >ReferenceError: URL is not defined - Nehemiah Blog
If you are using Node 8.11.2-x64, you may experience the below error when trying to fetch client packages like bootstrap or jquery from...
Read more >ReferenceError: URL is not defined [Temporary fix] · Issue #859
Hello, i am using the current version 4.4.3, i am getting ReferenceError: URL is not defined i had to comment out line 84...
Read more >Uncaught ReferenceError: url is not defined - JavaScript
I'm attempting to parse the URL into a variable, but I receive the following error: Uncaught ReferenceError: url is not defined.
Read more >T121529 Banner causes "ReferenceError: url is not defined"
ReferenceError : url is not defined. from this code: var full_banner = function() { $("div#WP15GetInvolvedPush a.cn-full-banner-click").attr("href",url); } ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was facing the same problem but I found out that the latest version of this package requires Node 10 or above.
Relevant links: Breaking Changes - https://github.com/GoogleChrome/lighthouse/releases/tag/v5.0.0 PR - https://github.com/googlechrome/lighthouse/pull/8117
Add this line at the top of script solved my issue global.URL = require(‘url’).URL;