Code node, cannot use external npm module


I encountered the same problem with another package (Can't use 'require package' in custom function after updating to 1.20.0 - #3 by CristianG).
I believe it has to do with how these new packages are developed.
I am not a skilled Node developer, so I cannot identify the exact issue.
In my case, the solution was to use an older version of the npm package.
Try using an older version of the chai package, found here: chai - npm

@Jon, I guess we will need to figure out how to import these newer packages that are using ESM.
I think this is a starting point: javascript - Error [ERR_REQUIRE_ESM]: require() of ES Module not supported - Stack Overflow, but I couldn’t fully understand the leading cause of the error, other than the fact that the developers used ESM in their packages.
As more developers are expected to start using it soon, we will need to find a way to import these packages into a Code node.