can't read tsconfig.base.json #865

Closed
opened 2026-03-13 08:07:41 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @draylegend on GitHub (Mar 17, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. open nx based project
  2. run bunx @better-auth/cli init

Current vs. Expected behavior

current

$ bunx @better-auth/cli init

  👋 Initializing Better Auth

   Couldn't read your tsconfig.json file. (dir: /home/dl/my-project)
Error: ENOENT: no such file or directory, open '/home/dl/my-project/tsconfig.json'
    at Object.readFileSync (node:fs:448:20)
    at getTsconfigInfo (file:///tmp/bunx-1000-@better-auth/cli@latest/node_modules/@better-auth/cli/dist/index.mjs:130:21)
    at Command.initAction (file:///tmp/bunx-1000-@better-auth/cli@latest/node_modules/@better-auth/cli/dist/index.mjs:1701:26) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/dl/my-project/tsconfig.json'
}

expected:
cli option like --tsconfig=tsconfig.base.json

What version of Better Auth are you using?

1.2.4

Provide environment information

$ nx report

 NX   Report complete - copy this into the issue template

Node           : 20.18.2
OS             : linux-x64
Native Target  : x86_64-linux
bun            : 1.2.5

nx                     : 20.6.1
@nx/js                 : 20.6.1
@nx/eslint             : 20.6.1
@nx/workspace          : 20.6.1
@nx/angular            : 20.6.1
@nx/devkit             : 20.6.1
@nx/esbuild            : 20.6.1
@nx/eslint-plugin      : 20.6.1
@nx/module-federation  : 20.6.1
@nx/rspack             : 20.6.1
@nx/web                : 20.6.1
@nx/webpack            : 20.6.1
typescript             : 5.8.2
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
---------------------------------------
Community plugins:
angular-eslint : 19.2.1
---------------------------------------
Cache Usage: 360.00 B / 100.69 GB

Which area(s) are affected? (Select all that apply)

Package

Auth config (if applicable)


Additional context

No response

Originally created by @draylegend on GitHub (Mar 17, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. open nx based project 1. run `bunx @better-auth/cli init` ### Current vs. Expected behavior current ```js $ bunx @better-auth/cli init ┌ 👋 Initializing Better Auth │ ■ ❌ Couldn't read your tsconfig.json file. (dir: /home/dl/my-project) Error: ENOENT: no such file or directory, open '/home/dl/my-project/tsconfig.json' at Object.readFileSync (node:fs:448:20) at getTsconfigInfo (file:///tmp/bunx-1000-@better-auth/cli@latest/node_modules/@better-auth/cli/dist/index.mjs:130:21) at Command.initAction (file:///tmp/bunx-1000-@better-auth/cli@latest/node_modules/@better-auth/cli/dist/index.mjs:1701:26) { errno: -2, code: 'ENOENT', syscall: 'open', path: '/home/dl/my-project/tsconfig.json' } ``` expected: cli option like `--tsconfig=tsconfig.base.json` ### What version of Better Auth are you using? 1.2.4 ### Provide environment information ```bash $ nx report NX Report complete - copy this into the issue template Node : 20.18.2 OS : linux-x64 Native Target : x86_64-linux bun : 1.2.5 nx : 20.6.1 @nx/js : 20.6.1 @nx/eslint : 20.6.1 @nx/workspace : 20.6.1 @nx/angular : 20.6.1 @nx/devkit : 20.6.1 @nx/esbuild : 20.6.1 @nx/eslint-plugin : 20.6.1 @nx/module-federation : 20.6.1 @nx/rspack : 20.6.1 @nx/web : 20.6.1 @nx/webpack : 20.6.1 typescript : 5.8.2 --------------------------------------- Registered Plugins: @nx/eslint/plugin --------------------------------------- Community plugins: angular-eslint : 19.2.1 --------------------------------------- Cache Usage: 360.00 B / 100.69 GB ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-03-13 08:07:41 -05:00
Author
Owner

@draylegend commented on GitHub (Mar 19, 2025):

also can't use generate cmd. Getting error

$ bunx @better-auth/cli generate --config libs/auth/api/src/lib/auth.ts --output schema.zmodel
2025-03-19T23:11:56.148Z ERROR [Better Auth]: Couldn't read your auth config. Error: Cannot find module '@my-project/organization-api'
Require stack:
- /home/dl/my-project/libs/auth/api/src/lib/auth.ts
  at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
  at Function.resolve (node:internal/modules/helpers:190:19)
  at jitiResolve (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:187220)
  at jitiRequire (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:189288)
  at import (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:199778)
  at /home/dl/my-project/libs/auth/api/src/lib/auth.ts:1:223
  at eval_evalModule (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:196325)
  at jitiRequire (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:190233)
  at Function.import (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:199778)
  at resolveConfig (file:///tmp/bunx-1000-@better-auth/cli@latest/node_modules/c12/dist/shared/c12.PQMoYrit.mjs:346:43) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/dl/my-project/libs/auth/api/src/lib/auth.ts' ]
  }
@draylegend commented on GitHub (Mar 19, 2025): also can't use generate cmd. Getting error ```js $ bunx @better-auth/cli generate --config libs/auth/api/src/lib/auth.ts --output schema.zmodel 2025-03-19T23:11:56.148Z ERROR [Better Auth]: Couldn't read your auth config. Error: Cannot find module '@my-project/organization-api' Require stack: - /home/dl/my-project/libs/auth/api/src/lib/auth.ts at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15) at Function.resolve (node:internal/modules/helpers:190:19) at jitiResolve (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:187220) at jitiRequire (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:189288) at import (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:199778) at /home/dl/my-project/libs/auth/api/src/lib/auth.ts:1:223 at eval_evalModule (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:196325) at jitiRequire (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:190233) at Function.import (/tmp/bunx-1000-@better-auth/cli@latest/node_modules/jiti/dist/jiti.cjs:1:199778) at resolveConfig (file:///tmp/bunx-1000-@better-auth/cli@latest/node_modules/c12/dist/shared/c12.PQMoYrit.mjs:346:43) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/dl/my-project/libs/auth/api/src/lib/auth.ts' ] } ```
Author
Owner

@draylegend commented on GitHub (Mar 19, 2025):

temporal solution is to dublicate tsconfig.base.json and rename to tsconfig.ts. I think it's simpler to leave the tsconfig.json instead of rewriting the imports in auth to relative paths

@draylegend commented on GitHub (Mar 19, 2025): temporal solution is to dublicate tsconfig.base.json and rename to tsconfig.ts. I think it's simpler to leave the tsconfig.json instead of rewriting the imports in auth to relative paths
Author
Owner

@Kinfe123 commented on GitHub (May 3, 2025):

it is fixed it will be up on the next releases.

@Kinfe123 commented on GitHub (May 3, 2025): it is fixed it will be up on the next releases.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#865