{"schemaVersion":"1.0","canonicalUrl":"https://automationtester.in/failures/dependency-module-not-found","slug":"dependency-module-not-found","title":"Module not found during tests","signature":"Cannot find module 'package-name'","frameworks":["Jest","pytest","CI"],"classification":"dependency","summary":"The test runtime could not resolve a package, local module, generated artifact, or configured path alias.","causes":[{"title":"The dependency is missing from the locked install","explanation":"A transitive or globally installed local dependency hid the omission.","diagnostic":"Install from the lockfile in a clean environment and inspect direct dependencies.","fix":"Declare the package in the correct production or test dependency group."},{"title":"Path aliases differ between compiler and runner","explanation":"TypeScript may resolve an alias that Jest or another runner does not know.","diagnostic":"Compare tsconfig paths with the test runner's module mapping.","fix":"Derive both configurations from one alias source or mirror them explicitly."},{"title":"A generated file was not created","explanation":"Schema clients, code generation, or build artifacts may be absent in CI.","diagnostic":"Check the generation step and expected file before starting tests.","fix":"Run deterministic generation after install and cache only compatible output."}],"prevention":["Test clean lockfile installs.","Align resolver configuration.","Verify generated artifacts before collection."],"related":["pytest-fixture-not-found","dns-resolution-failed-in-ci"],"references":[{"label":"Jest module paths","url":"https://jestjs.io/docs/configuration#modulenamemapper-objectstring-string--arraystring"}]}