agent-nodejs
agent-nodejs copied to clipboard
TypeError: Class CustomErrorStrategy extends undefined antlr4 DefaultErrorStrategy
Actual behavior
Using @forestadmin/[email protected]
with @forestadmin/[email protected]
throws the following error:
node_modules/@forestadmin/datasource-customizer/dist/decorators/search/custom-parser/custom-error-strategy.js:4
class CustomErrorStrategy extends antlr4_1.DefaultErrorStrategy {
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (node_modules/@forestadmin/datasource-customizer/dist/decorators/search/custom-parser/custom-error-strategy.js:4:44)
Context
-
DefaultErrorStrategy
is from theantlr4
package, which had an old, related issue: https://github.com/antlr/antlr4/issues/4287 - Import was introduced in a recent PR: https://github.com/ForestAdmin/agent-nodejs/pull/780/files#diff-e118123d0895dab51705d921cb6fdd344a27fcc717c457d9d1de3728e894c8e1R1
Hello @glarivie,
Could you provide more information on when you're encountering this issue, I have not been able to reproduce using @forestadmin/[email protected]
After investigating, it turns out that the cause of the problem is our packages manager: yarn 4. The problem does not occur with a package manager such as npm or yarn 1. And I can confirm that @forestadmin/[email protected]
works correctly with yarn 4.
I don't know why but [email protected]
(instead of [email protected]
) is installed for @forestadmin/[email protected]
and @forestadmin/[email protected]
. I need to use this trick in my package.json to deal with this issue :
"resolutions": {
"antlr4": "4.13.1-patch-1"
}
I had the same issue. Thanks a lot for the tip @glarivie !