datadogapm

Module not found: Can't resolve 'async_hooks' after adding dd-trace dependency


I have an FE app written in React & Node and I need to add to it dd-trace. I have run npm install dd-trace and afterwards it was saying that I also need to install async_hooks, so I run npm install async_hooks. Both commands run fine, but when I'm running npm start, I receive the following error:

Failed to compile. ./node_modules/dd-trace/packages/dd-trace/src/scope/async_resource.js Module not found: Can't resolve 'async_hooks' in PATH

I have checked that path and I have async_resource on that folder, but for some reason is not seen.

Any suggestions on how to fix this error or what I'm doing wrong?


Solution

  • Datadog APM doesn't support running in the browser, so installing dd-trace wouldn't work. You should instead use RUM by installing the browser SDK.