0

I'm getting the above error when I'm running my test. I've spent ages looking at the other similar errors reported on here but I just can't resolve it. I've removed node-fetch and installed node-fetch@2 but I'm still getting the same error. Any ideas greatly appreciated.

Full error below:

 C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\lighthouse-net-27ff76f3f84d40a58d9de15aa6a11935.js:2const lighthouse = require('C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Roaming\\npm\\node_modules\\lighthouse');                   ^Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\node_modules\lighthouse\core\index.js from C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\lighthouse-net-27ff76f3f84d40a58d9de15aa6a11935.js not supported.Instead change the require of index.js in C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\lighthouse-net-27ff76f3f84d40a58d9de15aa6a11935.js to a dynamic import() which is available in all CommonJS modules.    at Object.<anonymous> (C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\lighthouse-net-27ff76f3f84d40a58d9de15aa6a11935.js:2:20) {  code: 'ERR_REQUIRE_ESM'}Node.js v18.14.2 System.Exception: C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\lighthouse-net-27ff76f3f84d40a58d9de15aa6a11935.js:2const lighthouse = require('C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Roaming\\npm\\node_modules\\lighthouse');                   ^Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\node_modules\lighthouse\core\index.js from C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\lighthouse-net-27ff76f3f84d40a58d9de15aa6a11935.js not supported.Instead change the require of index.js in C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\lighthouse-net-27ff76f3f84d40a58d9de15aa6a11935.js to a dynamic import() which is available in all CommonJS modules.    at Object.<anonymous> (C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\lighthouse-net-27ff76f3f84d40a58d9de15aa6a11935.js:2:20) {  code: 'ERR_REQUIRE_ESM'}Node.js v18.14.2
    at lighthouse.net.Core.Node.OnError(String message)
    at lighthouse.net.Core.TerminalBase.Execute(String arguments)
    at lighthouse.net.Core.Node.Run(String jsFilePath)
    at lighthouse.net.Lighthouse.RunAfterCheck(AuditRequest request)
    at lighthouse.net.Lighthouse.Run(String urlWithProtocol)
    at GoogleLighthouse.Helpers.LighthouseAudit.RunLighthouseAudit(String AuditURL, String Client, String Strategy) in C:\ADO_Agent_GL\_work\1\s\Helpers\LighthouseAudit.cs:line 45
    at GoogleLighthouse.Steps.MajorRetailerLeagueTableSteps.GivenWeAuditTheWebsiteForAMajorRetailClientAsync(String website, String client, String strategy) in C:\ADO_Agent_GL\_work\1\s\Steps\MajorRetailerLeagueTableSteps.cs:line 16
    at TechTalk.SpecFlow.Bindings.SynchronousBindingDelegateInvoker.<>c__DisplayClass2_0.<<InvokeBindingDelegateAsync>b__0>d.MoveNext() in D:\a\1\s\TechTalk.SpecFlow\Bindings\SynchronousBindingDelegateInvoker.cs:line 31
 --- End of stack trace from previous location ---
    at TechTalk.SpecFlow.Bindings.AsyncHelpers.<>c__DisplayClass1_0`1.<<RunSync>b__0>d.MoveNext() in D:\a\1\s\TechTalk.SpecFlow\Bindings\AsyncHelpers.cs:line 59
 --- End of stack trace from previous location ---
    at TechTalk.SpecFlow.Bindings.AsyncHelpers.ExclusiveSynchronizationContext.BeginMessageLoop() in D:\a\1\s\TechTalk.SpecFlow\Bindings\AsyncHelpers.cs:line 124
    at TechTalk.SpecFlow.Bindings.AsyncHelpers.RunSync[T](Func`1 task) in D:\a\1\s\TechTalk.SpecFlow\Bindings\AsyncHelpers.cs:line 71
    at TechTalk.SpecFlow.Bindings.SynchronousBindingDelegateInvoker.InvokeBindingDelegateAsync(Delegate bindingDelegate, Object[] invokeArgs) in D:\a\1\s\TechTalk.SpecFlow\Bindings\SynchronousBindingDelegateInvoker.cs:line 27
    at TechTalk.SpecFlow.Bindings.SynchronousBindingDelegateInvoker.InvokeDelegateSynchronously(Delegate bindingDelegate, Object[] invokeArgs) in D:\a\1\s\TechTalk.SpecFlow\Bindings\SynchronousBindingDelegateInvoker.cs:line 16
    at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) in D:\a\1\s\TechTalk.SpecFlow\Bindings\BindingInvoker.cs:line 43
    at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments, TimeSpan& duration) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 567
    at TechTalk.SpecRun.SpecFlowPlugin.Runtime.RunnerTestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments, TimeSpan& duration)
    at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 522
    at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 234
    at TechTalk.SpecRun.SpecFlowPlugin.Runtime.RunnerTestExecutionEngine.OnAfterLastStep()
    at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors() in D:\a\1\s\TechTalk.SpecFlow\TestRunner.cs:line 59
    at GoogleLighthouse.Features.MajorRetailerLeagueTableForDesktopFeature.ScenarioCleanup()
    at GoogleLighthouse.Features.MajorRetailerLeagueTableForDesktopFeature.LeagueTableForDesktop(String client, String website, String strategy, String[] exampleTags) in C:\ADO_Agent_GL\_work\1\s\Features\MajorRetailerDesktop.feature:line 9
    at GoogleLighthouse.Features.MajorRetailerLeagueTableForDesktopFeature.LeagueTableForDesktop_Debenhams() in C:\ADO_Agent_GL\_work\1\s\Features\MajorRetailerDesktop.feature:line 6
    at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.ExecuteInternal(ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.Execute(ITestThreadExecutionContext testThreadExecutionContext)
    at TechTalk.SpecRun.Framework.TestNodeTask.Execute()

Tried all the various fixes already detailed on here.

CForsh75
  • 23
  • 1
  • 5

0 Answers0