adk-js icon indicating copy to clipboard operation
adk-js copied to clipboard

Cannot find module '@opentelemetry/api'

Open tpiros opened this issue 1 week ago • 3 comments

Following the Getting Started Guide (https://google.github.io/adk-docs/get-started/typescript/#define-the-agent-code) the last step (npx @google/adk-devtools run agent.ts) throws:

Error: Cannot find module '@opentelemetry/api'

it seems that doing the two npm installs of @google/adk and @google/adk-devtools doesn't install a myriad of dependencies. I could only run the adk-devtools command only when I also added the following to my package.json and installed these:

"dependencies": {
    "@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.21.0",
    "@google-cloud/opentelemetry-cloud-trace-exporter": "^3.0.0",
    "@google-cloud/storage": "^7.18.0",
    "@google/adk": "^0.2.1",
    "@opentelemetry/api": "^1.9.0",
    "@opentelemetry/api-logs": "^0.208.0",
    "@opentelemetry/exporter-logs-otlp-http": "^0.208.0",
    "@opentelemetry/exporter-metrics-otlp-http": "^0.208.0",
    "@opentelemetry/exporter-trace-otlp-http": "^0.208.0",
    "@opentelemetry/resource-detector-gcp": "^0.44.0",
    "@opentelemetry/resources": "^2.2.0",
    "@opentelemetry/sdk-logs": "^0.208.0",
    "@opentelemetry/sdk-metrics": "^2.2.0",
    "@opentelemetry/sdk-trace-base": "^2.2.0",
    "@opentelemetry/sdk-trace-node": "^2.2.0"
  },

tpiros avatar Dec 18 '25 12:12 tpiros

Thank you for notifying us of an issue with the getting started guide. I am working to reproduce locally.

ScottMansfield avatar Dec 18 '25 21:12 ScottMansfield

I followed the steps outlined in the getting started page and was able to run successfully without error. A couple other people internally have confirmed the same. Did you start from a clean project?

As an aside, we are looking into the dependency management and may change to make this more clear.

ScottMansfield avatar Dec 18 '25 21:12 ScottMansfield

Thank you for looking into this @ScottMansfield. I have created a brand new project, and again I ran into the same issue. See attached including my node and npm versions.

Image

tpiros avatar Dec 19 '25 05:12 tpiros