#Clawdhub ERR_MODULE_NOT_FOUND due to 'undici' package

1 messages Β· Page 1 of 1 (latest)

tulip vine
#
❯ clawdhub sync
node:internal/modules/package_json_reader:314
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'undici' imported from /Users/sean/.nvm/versions/node/v22.22.0/lib/node_modules/clawdhub/dist/http.js
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:314:9)
    at packageResolve (node:internal/modules/esm/resolve:767:81)
    at moduleResolve (node:internal/modules/esm/resolve:853:18)
    at defaultResolve (node:internal/modules/esm/resolve:983:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:731:20)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:310:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:182:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v22.22.0

Similar with other installation methods:

❯ bunx clawdhub@latest install homeassistant
node:internal/modules/package_json_reader:314
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'undici' imported from /private/tmp/bunx-501-clawdhub@latest/node_modules/clawdhub/dist/http.js
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:314:9)
    at packageResolve (node:internal/modules/esm/resolve:767:81)
    at moduleResolve (node:internal/modules/esm/resolve:853:18)
    at defaultResolve (node:internal/modules/esm/resolve:983:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:731:20)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:310:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:182:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v22.22.0
prisma oakBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

ivory lavaBOT
#
   git clone https://github.com/clawdbot/clawdhub.git
   cd clawdhub
   bun install
   bun --bun link # creates global bin
   clawdhub sync

The root cause is that when running via bunx/npx, the temporary installation doesn't properly install undici as a peer dependency even though http.ts imports it. This should be fixed in the clawdhub repo by adding undici to packages/clawdhub/package.json.

Want me to open an issue on the clawdhub repo for this?

tulip vine
#
❯ pnpm install -g clawdhub
Packages: +34
++++++++++++++++++++++++++++++++++
Progress: resolved 34, reused 34, downloaded 0, added 0, done

/Users/sean/Library/pnpm/global/5:
+ clawdhub 0.3.0

Done in 885ms using pnpm v10.28.1
❯ which clawdhub
/Users/sean/Library/pnpm/clawdhub
❯ clawdhub
node:internal/modules/package_json_reader:314
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'undici' imported from /Users/sean/Library/pnpm/global/5/.pnpm/clawdhub@0.3.0/node_modules/clawdhub/dist/http.js
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:314:9)
    at packageResolve (node:internal/modules/esm/resolve:767:81)
    at moduleResolve (node:internal/modules/esm/resolve:853:18)
    at defaultResolve (node:internal/modules/esm/resolve:983:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:731:20)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:310:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:182:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v22.22.0

pnpm didn't fix it btw.

ivory lavaBOT
# tulip vine ``` ❯ pnpm install -g clawdhub Packages: +34 ++++++++++++++++++++++++++++++++++ ...

That's because undici is missing from the dependency list entirely in packages/clawdhub/package.json β€” it's an actual missing dependency, not a peer dep issue.

Quick fix right now:

npm install -g undici
clawdhub sync

Permanent fix needed: The clawdhub repo needs to add undici to dependencies in packages/clawdhub/package.json:

"dependencies": {
    "undici": "^6.0.0",  // <-- missing!
    "@clack/prompts": "^0.11.0",
    ...
#
}

Want me to open a GitHub issue on the clawdhub repo so this gets fixed properly?

tulip vine
#

Yes can you open a github issue on clawdhub

ivory lavaBOT
# tulip vine Yes can you open a github issue on clawdhub

I don't have GitHub auth available to create the issue directly. Here's the ready-to-paste issue content:


Issue Title: CLI fails with ERR_MODULE_NOT_FOUND: Cannot find package 'undici'

Body:

The clawdhub CLI fails immediately with an `ERR_MODULE_NOT_FOUND` error because `undici` is imported in `packages/clawdhub/src/http.ts` but is not listed as a dependency in `packages/clawdhub/package.json`.

## Error

❯ clawdhub sync
node:internal/modules/package_json_reader:314
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^

#

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'undici' imported from /Users/sean/.nvm/versions/node/v22.22.0/lib/node_modules/clawdhub/dist/http.js


## Cause
In `packages/clawdhub/src/http.ts`:
```typescript
import { Agent, setGlobalDispatcher } from 'undici'

But undici is missing from the dependencies in packages/clawdhub/package.json.

Fix

Add undici to the dependencies:

"dependencies": {
    "undici": "^6.0.0",
    ...
#

}


## Workaround
```bash
npm install -g undici

Then clawdhub works.


Reported by @seanabraham in Discord.


<https://github.com/clawdbot/clawdhub/issues/new>