Cannot import jdl file using jhipster

Viewed 186

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 Answers

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":{
      "chevrotain@10.1.2": {
      "@chevrotain/gast": "10.1.2"
     }
    }

This will prevent the JHipster using latest package of that.

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 generator-jhipster@7.8.1
  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
Related