Hendrixer / agent-from-scratch

19 stars 25 forks source link

Adding an override for whatwg-url to remove Node's DeprecationWarning about punycode #3

Open RobinCsl opened 5 days ago

RobinCsl commented 5 days ago

Hello Scott,

Just going through the replay of your workshop and cloned the repo, managed to get things running.

With Node.js v22.7.0, I got a warning in the console, which makes the output less nice to read:

$ NODE_OPTIONS="--trace-deprecation" npm start "hello, my name is Smith"

> start
> npx tsx index.ts hello, my name is Smith

(node:227918) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:399:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
    at loadBuiltinModule (node:internal/modules/helpers:99:7)
    at Module._load (node:internal/modules/cjs/loader:1099:17)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:126:16)
    at Object.<anonymous> (.../agent-from-scratch/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
Hello, Smith! How can I assist you today?

You might want to consider adding this overrides in the package.json file to make the warning go away (after another npm install)

"overrides": {
  "whatwg-url": "13.0.0"
}

Got this solution from https://github.com/openai/openai-node/issues/527#issuecomment-2409031884 and it works fine for me.

All the best.

dtauer commented 3 days ago

Thank you for posting this! We'll be starting QA work on the course this week and will get the documentation of the course updated along with this fix.