Skip to content

"Cannot find module ..." when running TypeDoc outside of TS project folder #1300

Closed
@davidjenkins

Description

@davidjenkins

Expected Behavior

Compile same as calling tsc directly when specifying path to tsconfig file.

Calling tsc directly from any directory like tsc -project /path/to/some/far/away/tsconfig.json works without any problems.

Actual Behavior

Cannot find typings in node_modules folder that is in same folder as tsconfig file. Throws errors like "Cannot find module '<module_name>'.".

Steps to reproduce the bug

  • Create project folder for source code (/my-library/src)
    • with tsconfig.json file
    • with node_modules folder
      • with various typings in @types folder
  • Create project folder for docs (/my-library/docs)
    • with package.json file
      • with typedoc depedency
      • with typescript depedency
      • with build script to run typedoc "typedoc --json api.json --tsconfig ../src/tsconfig.json"
  • Run build script, throws errors about not finding typings that exist in the node_modules folder that is in the same folder as the tsconfig file.

Environment

  • Typedoc version: 0.17.6
  • TypeScript version: 3.8.3
  • Node.js version: 12.16.3
  • OS: Windows 10

Workarounds

  • Use build script to change current working directory, like "cd ../src && typedoc --json ../docs/api.json --tsconfig tsconfig.json"
  • Use --ignoreCompilerErrors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions