Cannot import jdl file using jhipster

822 Views Asked by At

I'm new to jhipster. I am on jhipster v7.8.1, i can generate an app using the cli questions but when i try importing a jdl file i got the following error:

**ERROR! Class constructor GAstVisitor cannot be invoked without 'new' TypeError: Class constructor GAstVisitor cannot be invoked without 'new' at new DslMethodsCollectorVisitor

2

There are 2 best solutions below

5
Priyantha Buddhika On

This occurs due to a recent bug in the one of JHipster libraries. As a temporary solution you can go to the JHipster installed location and find it's package.json file and override the package causing this error as follows. Then run npm install again.

    "overrides":{
      "[email protected]": {
      "@chevrotain/gast": "10.1.2"
     }
    }

This will prevent the JHipster using latest package of that.

0
Umar Kayondo On

I experienced the same error and managed to get the JDL file to run by using version 7.8.1 I followed the following steps to get this done;

  1. uninstall the current version of jhipster that is causing issues for my case this was 7.9.2 . use this command npm uninstall -g generator-jhipster
  2. Install version 7.8.1 using this command npm install -g [email protected]
  3. Attempt to run your JDL using this command jhipster jdl jhipster-jdl.jdl
  4. At this stage, your JDL will be able to run