Missing undici dependency in package.json causes ERR_MODULE_NOT_FOUND on fresh install #16

Closed
opened 2026-02-15 17:15:06 -05:00 by yindo · 1 comment
Owner

Originally created by @webdevtodayjason on GitHub (Jan 26, 2026).

Description

After installing clawdhub globally via npm, the CLI fails immediately with a module resolution error for the undici package.

Environment

  • Node.js version: v20.20.0 (LTS "Iron")
  • npm version: 10.8.2
  • ClawdHub version: 0.3.0
  • OS: macOS (arm64)

Steps to Reproduce

  1. Install ClawdHub globally:

    npm install -g clawdhub
    
  2. Try to run any ClawdHub command:

    clawdhub --version
    

Expected Behavior

ClawdHub should execute successfully and display its version or help information.

Actual Behavior

The command fails with the following error:

node:internal/modules/esm/resolve:873
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'undici' imported from /Users/sem/.nvm/versions/node/v20.20.0/lib/node_modules/clawdhub/dist/http.js
    at packageResolve (node:internal/modules/esm/resolve:873:9)
    at moduleResolve (node:internal/modules/esm/resolve:946:18)
    at defaultResolve (node:internal/modules/esm/resolve:1188:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:657:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:640:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:264:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:168:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Root Cause

The undici package is used in dist/http.js but is not declared as a dependency in package.json. This means it's not installed when users run npm install -g clawdhub.

Workaround

Manually install undici in the ClawdHub module directory:

cd ~/.nvm/versions/node/v20.20.0/lib/node_modules/clawdhub
npm install undici

After this, ClawdHub works as expected.

Suggested Fix

Add undici to the dependencies section of package.json:

{
  "dependencies": {
    "undici": "^6.0.0"
  }
}

Additional Context

This issue appears to affect fresh installations on Node v20 (LTS). The package may have worked in development if undici was present in node_modules from other dependencies or bundled differently during the build process.

Originally created by @webdevtodayjason on GitHub (Jan 26, 2026). ## Description After installing `clawdhub` globally via npm, the CLI fails immediately with a module resolution error for the `undici` package. ## Environment - **Node.js version**: v20.20.0 (LTS "Iron") - **npm version**: 10.8.2 - **ClawdHub version**: 0.3.0 - **OS**: macOS (arm64) ## Steps to Reproduce 1. Install ClawdHub globally: ```bash npm install -g clawdhub ``` 2. Try to run any ClawdHub command: ```bash clawdhub --version ``` ## Expected Behavior ClawdHub should execute successfully and display its version or help information. ## Actual Behavior The command fails with the following error: ``` node:internal/modules/esm/resolve:873 throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null); ^ Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'undici' imported from /Users/sem/.nvm/versions/node/v20.20.0/lib/node_modules/clawdhub/dist/http.js at packageResolve (node:internal/modules/esm/resolve:873:9) at moduleResolve (node:internal/modules/esm/resolve:946:18) at defaultResolve (node:internal/modules/esm/resolve:1188:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12) at #cachedDefaultResolve (node:internal/modules/esm/loader:657:25) at ModuleLoader.resolve (node:internal/modules/esm/loader:640:38) at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:264:38) at ModuleJob._link (node:internal/modules/esm/module_job:168:49) { code: 'ERR_MODULE_NOT_FOUND' } ``` ## Root Cause The `undici` package is used in `dist/http.js` but is not declared as a dependency in `package.json`. This means it's not installed when users run `npm install -g clawdhub`. ## Workaround Manually install `undici` in the ClawdHub module directory: ```bash cd ~/.nvm/versions/node/v20.20.0/lib/node_modules/clawdhub npm install undici ``` After this, ClawdHub works as expected. ## Suggested Fix Add `undici` to the `dependencies` section of `package.json`: ```json { "dependencies": { "undici": "^6.0.0" } } ``` ## Additional Context This issue appears to affect fresh installations on Node v20 (LTS). The package may have worked in development if `undici` was present in `node_modules` from other dependencies or bundled differently during the build process.
yindo closed this issue 2026-02-15 17:15:06 -05:00
Author
Owner

@webdevtodayjason commented on GitHub (Jan 26, 2026):

Closing as duplicate of #23, which was opened earlier with the same issue.

@webdevtodayjason commented on GitHub (Jan 26, 2026): Closing as duplicate of #23, which was opened earlier with the same issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/clawhub#16