ts-node: `ERR_LOADER_CHAIN_INCOMPLETE` issue with Node.js v18.6.0

Originating issue: https://github.com/cypress-io/cypress/issues/22795

Search Terms

ERR_LOADER_CHAIN_INCOMPLETE, cypress

Expected Behavior

Don’t short circuit on resolve? Although @cspotcode indicated that this might be a red herring.

Actual Behavior

Steps to reproduce the problem

Working on a minimal sample that doesn’t include Cypress…

Minimal reproduction

Working on a minimal sample that doesn’t include Cypress…

Specifications

  • ts-node version: v10.9.1
  • node version: v18.6.0
  • TypeScript version: v4.7.4
  • tsconfig.json, if you’re using one:
{}
  • package.json:
{}
  • Operating system and version:

So far I’ve only seen the issue occur on Linux in CI, not Windows.

This is from the GitLab runner (Docker):

$ uname -a
Linux runner-jiyxuj1z-project-3385-concurrent-0 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ npx ts-node -vvv
ts-node v10.9.1 /project/node_modules/ts-node
node v18.6.0
compiler v4.7.4 /project/node_modules/typescript/lib/typescript.js

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15

Commits related to this issue

Most upvoted comments

Based on linked issues, sounds like this is fixed by upgrading ts-node to the latest version. Node made a breaking change to loaders and we updated accordingly. But if you’re using an old version of ts-node then you won’t have that necessary update.

Gonna close this. If anyone hits a situation where they think ts-node needs to make a code change, please open a new issue, and link to this one if appropriate.

I had the same issue, but upgrading to the latest ts-node (10.9.1) and doing rm -rf node_modules did solve the issue with Node 18.6.

I see the same issue without any Cypress. Node 16.17.1, ts-node 10.7.0. Updating ts-node to 10.9.1 fixed it.

This was most likely caused by a change brought by the node package being auto-updated.

Based on the descriptions above, cypress needs to use the latest ts-node, so it actually depends on cypress doing the right thing, not necessarily you upgrading. Keep in mind that npm often has multiple different versions of a single package installed in a dependency tree.

We noticed this problem too when trying to upgrade to Cypress 10.6 from 9.5, on Node 16. Upgrading ts-node to latest did not help.

But downgrading Node from 16.17.0 to 16.16.0 does fix the issue.

The absolute latest version of ts-node is required for node 18.6.0. That would be ts-node 10.9.1, which was released yesterday.

Friendly reminder for anyone reading along, that node’s loader hooks are “experimental” status, with everything that implies: https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#loaders