Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_LOADER_CHAIN_INCOMPLETE issue with Node.js v18.6.0 #1839

Closed
brianjenkins94 opened this issue Jul 15, 2022 · 15 comments
Closed

ERR_LOADER_CHAIN_INCOMPLETE issue with Node.js v18.6.0 #1839

brianjenkins94 opened this issue Jul 15, 2022 · 15 comments
Labels

Comments

@brianjenkins94
Copy link

brianjenkins94 commented Jul 15, 2022

Originating issue: cypress-io/cypress#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
@cspotcode
Copy link
Collaborator

I'm guessing that this is being caused by a combination of the file being imported, and the file it's imported from, so I might be able to reproduce given those two bits of data, even if you don't have a complete reproduction.

@brianjenkins94
Copy link
Author

I've actually only had the issue happen in CI so far, I just saw some buzz around the original issue and wanted to get something filed so we'd have something to work off of.

I'll see if I can identify the file being imported, and the file it's imported from.

Anybody else with something closer to a reproducible sample, feel free to chime in.

@cspotcode
Copy link
Collaborator

Do you think it might be related to stuff happening within node_modules? Our default "ignore" mechanism doesn't touch stuff in node_modules, so perhaps that's triggering a different code path in our hooks?

Is there at least a simple cypress invocation that reproduces it? Or perhaps is it a race condition? A lot of this loader stuff is async, maybe we're triggering a bug inside node?

@brianjenkins94
Copy link
Author

brianjenkins94 commented Jul 15, 2022

Here is a minimal reproducible sample using Cypress: ts-node-1839.zip

Using VSCode to open the above as a dev container, reproduce with:

$ npm install
$ npx cypress run

@neuronetio
Copy link

neuronetio commented Jul 15, 2022

I don't know if it matters but the latest Cypress 10.3.0 uses ts-node version 10.7.0.
AND #1714 is released in 10.8.0?
I mentioned on the Cypress repo cypress-io/cypress#22795 (comment) that #1714 is related to this bug, to let the Cypress team know that they need to update the library? (I don't know if 10.8.0 will work with the latest nodejs)

What I mean is not to do some hacks until cypress checks if the latest version of ts-node will work for them.

@brianjenkins94
Copy link
Author

brianjenkins94 commented Jul 15, 2022

The only thing that doesn't quite add up about that is the timing. I only started seeing this issue around the 13th with the release of Node v18.6.0.

Could still be a contributing factor though. Great catch.

@cspotcode
Copy link
Collaborator

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

@brianjenkins94
Copy link
Author

brianjenkins94 commented Jul 15, 2022

Okay so this is a Cypress problem, not a ts-node problem unless @faradaytrs has details relating to their issue that suggest otherwise.

@cspotcode
Copy link
Collaborator

That's my current guess, but if a reproduction shows this happening with ts-node 10.9.1 then I'll dig into it.

I see that the error, when it occurs, logs the path to ts-node. That should allow someone to open up the package.json and double-check the version number. Since it's always possible in node_modules trees for multiple versions of a library to be installed.

@cspotcode
Copy link
Collaborator

Marked "external" till we confirm with the cypress folks.

@RobinTail
Copy link

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.

@cspotcode
Copy link
Collaborator

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.

@DavidBanksNZ
Copy link

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.

@cspotcode
Copy link
Collaborator

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.

@dandv
Copy link

dandv commented Oct 23, 2022

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.

Menci added a commit to LibreOJ/bootstrap that referenced this issue Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants