Fix 'chatd cannot find module worker.js' Issue Easily
- Authors

- Name
- Geeks Kai
- @KaiGeeks
The wording “chatd cannot find module worker.js” is not enough to identify a cause. First confirm the product, version, operating system and complete missing path. BruceMacD/chatd is an Electron desktop app for chatting with local documents; it is different from a generic Node chat server.

In Chatd issue #48, a user reported a missing service/worker.js after opening a PDF or Markdown document in a downloaded macOS archive. That report documents a macOS case; it does not establish how frequently the error occurs on any OS or one repair for every release. Check the issue's current discussion and the release you installed before applying a workaround.
Record the exact missing path. A path under an unexpected working directory suggests a path-construction problem; a path inside an installed app with a missing asset suggests packaging or installation needs investigation. These are diagnostic leads, not proof of either cause.
Do not create an empty worker.js or install a guessed worker-module package. A file with the expected name does not implement the application's document-processing protocol. Reinstalling only makes sense when you have evidence of an incomplete installation and a trustworthy replacement, with local documents and settings preserved.
A CommonJS require path is resolved relative to the requiring module. A Node Worker filename given as a relative string is resolved relative to the current working directory. Mixing those rules can make a program work from one launch location and fail from another. See CommonJS resolution and the Worker filename contract.
This complete CommonJS diagnostic belongs beside the module whose workers/worker.js dependency you are inspecting. It resolves a path without loading or executing the worker:
// file: inspect-worker.cjs
const fs = require("node:fs")
const path = require("node:path")
const workerPath = path.join(__dirname, "workers", "worker.js")
console.log("Working directory:", process.cwd())
console.log("Candidate worker:", workerPath)
console.log("Exists:", fs.existsSync(workerPath))
try {
console.log("Resolved module:", require.resolve(workerPath))
} catch (error) {
console.error("Worker resolution failed:", error.code, error.message)
process.exitCode = 1
}
The workers directory is an example layout, not a claim about Chatd's internal package. For your application, inspect the actual import or Worker construction and the built output. In an ES module, a module-relative Worker can use new URL("./worker.js", import.meta.url); Electron packaging can require additional asset-copy and archive configuration. Do not replace a project path before checking that boundary.
For a source-code fix, repeat the original document-loading action and launch from both the project directory and a different working directory. Confirm that the built distribution includes the required worker and that its error/exit handling remains observable. A successful require.resolve check alone does not prove the worker started or processed a document.
Keep the lockfile. A missing local asset does not justify deleting package-lock.json, clearing the global npm cache or updating every dependency. If resolution still fails, provide a minimal reproduction and the exact build/launch commands to the project maintainers.
This guide identifies a matching upstream report and explains Node path rules. It does not claim that a particular Chatd release has been repaired or that document processing was tested here.