1
Error: ./node_modules/cls-hooked/context.js
Module not found: Error: Can't resolve 'async_hooks' 

After adding the applicationinsights package, I am getting the above error in my application.

I have added it by using this syntax require('applicationinsights'). I believe the problem lies in the require keyword. I tried every other internet answer related to this error but nothing worked.

Dinesh
  • 411
  • 6
  • 19
  • What version of Angular u are using? You are not using TS import? I am using Angular 12, and i use import as like this import { ApplicationInsights } from '@microsoft/applicationinsights-web'; – j1s Aug 25 '22 at 16:12
  • No, I am using https://www.npmjs.com/package/applicationinsights. Is it possible to show data in the Live Metrics(Azure Portal) by using @microsoft/applicationinsights-web? – Dinesh Aug 25 '22 at 16:36

1 Answers1

0

You are trying to use node.js appInsights. You have to use Angular's AppInsights package in Angular refer the below article

https://devblogs.microsoft.com/premier-developer/angular-how-to-add-application-insights-to-an-angular-spa/#:~:text=Step%202%20%E2%80%93%20Configure%20Angular%20application%20and%20include%20dependencies

j1s
  • 160
  • 2
  • 18