"Couldn't find tsconfig.json" error in JavaScript monorepo
Current behavior
Running Cypress in a pure JavaScript monorepo project, where TypeScript is a transient dependency in the root of the monorepo, results in the warning:
"Couldn't find tsconfig.json. tsconfig-paths will be skipped."
if the dependencies for the root project are also installed.
Desired behavior
In a pure JavaScript monorepo (sub-)project with its own package.json containing no TypeScript references, the following warning should not be output. This should be independent of any TypeScript configured in the root of the repo.
"Couldn't find tsconfig.json. tsconfig-paths will be skipped."
tsconfig.json should not be required if a project is pure JavaScript.
Test code to reproduce
git clone https://github.com/cypress-io/github-action
cd github-action
git clean -xfd # if repeating tests
npm ci
cd examples/basic
npm ci
npm test
shows warning
"Couldn't find tsconfig.json. tsconfig-paths will be skipped."
then
rm -rf ../../node_modules
npm test
and confirm no warning regarding missing tsconfig.json.
Cypress Version
First reported in Cypress version: 14.0.0
Also reproducible in Cypress version: 13.17.0 & 14.1.0
Node version
~~v22.13.0 LTS~~ v22.14.0 LTS
Operating System
Ubuntu 24.04.1 LTS
Debug Logs
$ npm test
> [email protected] test
> cypress run
DevTools listening on ws://127.0.0.1:46049/devtools/browser/59c53df9-eae8-45e3-b33e-26a42e8939d7
Couldn't find tsconfig.json. tsconfig-paths will be skipped
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 14.0.0 │
│ Browser: Electron 130 (headless) │
│ Node Version: v22.13.0 (/home/mike/n/bin/node) │
│ Specs: 1 found (spec.cy.js) │
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
with root dependencies installed:
cypress:lifecycle:ProjectConfigIpc fork child process { CHILD_PROCESS_FILE_PATH: '/home/mike/.cache/Cypress/14.0.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/require_async_child.js', configProcessArgs: [ '--projectRoot', '/home/mike/github/cypress-io/github-action/examples/basic', '--file', '/home/mike/github/cypress-io/github-action/examples/basic/cypress.config.js' ], childOptions: { stdio: 'pipe', cwd: '/home/mike/github/cypress-io/github-action/examples/basic', execPath: '/home/mike/n/bin/node' } } +0ms
cypress:lifecycle:ProjectConfigIpc found typescript in /home/mike/github/cypress-io/github-action/examples/basic +6ms
cypress:lifecycle:ProjectConfigIpc using cjs with --require /home/mike/.cache/Cypress/14.0.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/register_ts_node.js +0ms
cypress:lifecycle:ProjectConfigIpc trigger the load of the file +25ms
Couldn't find tsconfig.json. tsconfig-paths will be skipped
cypress:lifecycle:ProjectConfigIpc loadConfig:reply +811ms
when root dependencies not installed:
cypress:lifecycle:ProjectConfigIpc fork child process { CHILD_PROCESS_FILE_PATH: '/home/mike/.cache/Cypress/14.0.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/require_async_child.js', configProcessArgs: [ '--projectRoot', '/home/mike/github/cypress-io/github-action/examples/basic', '--file', '/home/mike/github/cypress-io/github-action/examples/basic/cypress.config.js' ], childOptions: { stdio: 'pipe', cwd: '/home/mike/github/cypress-io/github-action/examples/basic', execPath: '/home/mike/n/bin/node' } } +0ms
cypress:lifecycle:ProjectConfigIpc no typescript found, just use regular Node.js +2ms
cypress:lifecycle:ProjectConfigIpc trigger the load of the file +13ms
cypress:lifecycle:ProjectConfigIpc loadConfig:reply +442ms
Other
This issue became apparent in https://github.com/cypress-io/github-action after the forced migration to @actions/[email protected] from @actions/[email protected]
Whereas @actions/[email protected] contains no typescript transient dependency, @actions/[email protected] pulls in @protobuf-ts/plugin@^2.9.4 and thereby typescript@^3.9:
$ npm ls typescript
└─┬ @actions/[email protected]
└─┬ @protobuf-ts/[email protected]
├─┬ @protobuf-ts/[email protected]
│ └── [email protected] deduped
└── [email protected]
The issue does not show up in the GitHub Action examples running in workflows because then only the dependencies of the tested project, such as examples/basic, are installed, without the unneeded dependencies of the root of the repo.
However, when working locally, if npm ci has been run in the root of the repo clone, and then npm ci is run in an example project, Cypress looks up the hierarchy and finds typescript in the root. It then assumes that the whole repo is TypeScript, which is incorrect.
@MikeMcC399 Similar to this issue, although that issue only mentions TS projects as a problem. https://github.com/cypress-io/cypress/issues/22273
@jennifer-shehane
- I know this has come up before. I also had https://github.com/cypress-io/cypress/issues/25335 open at one time, but closed it because it wasn't reproducible anymore.
- I thought it was worth submitting this as a separate issue, since it is well reproducible on a public repo.
I am going to close this issue as it will be resolved with Cypress 15, which is targeted for early July 2025.
Released in 15.0.0.
This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v15.0.0, please open a new issue.