jhipster / jhipster-dotnetcore

JHipster.NET blueprint
Apache License 2.0
313 stars 92 forks source link

Cannot read property 'otherEntityNamePascalized' of undefined #223

Closed amatosg closed 4 years ago

amatosg commented 4 years ago
Overview of the issue

When running jhipster import-jdl ../FacturApp/facturapp.jh I'm getting Cannot read property 'otherEntityNamePascalized' of undefined.

Full error log:

Webpack: Starting ...

  ✔ Compile modules
  ✔ Build modules
  ✔ Optimize modules
  ✔ Emit files

Webpack: Finished after 24.955 seconds.

 DONE  Compiled successfully in 24962ms                                                                                       13:46:59

   457 modules
     info Using blueprint generator-jhipster-dotnetcore for entity-i18n subgenerator
events.js:170
      throw er; // Unhandled 'error' event
      ^

Error: Copying template dotnetcore/src/Project/Models/JoinEntity.cs.ejs failed. [TypeError: /usr/local/lib/node_modules/generator-jhipster-dotnetcore/generators/entity-server/templates/dotnetcore/src/Project/Models/JoinEntity.cs.ejs:15
    13|  limitations under the License.
    14| -%>
 >> 15| <%_ let ownerEntityClassName;
    16| let ownerRelationshipFieldName;
    17| let nonOwnerEntityClassName;
    18| let nonOwnerRelationshipFieldName;

Cannot read property 'otherEntityNamePascalized' of undefined]
    at module.exports.error (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/generator-jhipster/generators/generator-base.js:1590:15)
    at ejs.renderFile (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/generator-jhipster/generators/utils.js:256:23)
    at tryHandleCache (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/generator-jhipster/node_modules/ejs/lib/ejs.js:275:14)
    at Object.exports.renderFile (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/generator-jhipster/node_modules/ejs/lib/ejs.js:478:10)
    at Object.renderContent (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/generator-jhipster/generators/utils.js:252:9)
    at module.exports.template (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/generator-jhipster/generators/generator-base-private.js:769:23)
    at blockTemplate.templates.forEach.templateObj (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/generator-jhipster/generators/generator-base.js:2040:42)
    at Array.forEach (<anonymous>)
    at module.exports.writeFilesToDisk (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/generator-jhipster/generators/generator-base.js:2002:45)
    at module.exports.writeServerFiles (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/generators/entity-server/files.js:112:18)
Emitted 'error' event at:
    at Immediate.setImmediate (/usr/local/lib/node_modules/generator-jhipster-dotnetcore/node_modules/yeoman-generator/lib/index.js:924:20)
    at processImmediate (internal/timers.js:443:21)

No entity was generated.

Motivation for or Use Case

I'm unable to import a JDL file.

Reproduce the error
Related issues

None.

Suggest a Fix

Not sure how to fix this. If I'm given guides, I could give it a try.

INFO! Using JHipster version installed globally INFO! No custom sharedOptions found within blueprint: generator-jhipster-dotnetcore at /usr/local/lib/node_modules/generator-jhipster-dotnetcore INFO! No custom commands found within blueprint: generator-jhipster-dotnetcore at /usr/local/lib/node_modules/generator-jhipster-dotnetcore INFO! Executing jhipster:info INFO! Options: from-cli: true Welcome to the JHipster Information Sub-Generator

JHipster Version(s)

I don't know why it states 6.8.0 when I have 6.9.0 already

/Users/alejandro
└── generator-jhipster@6.8.0
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "namespace": "FacturApp",
    "databaseType": "postgres",
    "authenticationType": "jwt",
    "prodDatabaseType": "mysql",
    "jhipsterVersion": "6.9.0",
    "applicationType": "monolith",
    "baseName": "FacturApp",
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "spacelab",
    "clientThemeVariant": "primary",
    "creationTimestamp": 1589914804447,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [
      {
        "name": "generator-jhipster-dotnetcore",
        "version": "1.0.0-alpha"
      }
    ],
    "enableTranslation": false,
    "blueprints": [
      {
        "name": "generator-jhipster-dotnetcore",
        "version": "1.0.0-alpha"
      }
    ]
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
Environment and Tools

openjdk version "11.0.5" 2019-10-15 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10) Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.17.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20191016_371 (JIT enabled, AOT enabled) OpenJ9 - 77c1cf708 OMR - 20db4fbc JCL - 2a7af5674b based on jdk-11.0.5+10)

git version 2.20.1 (Apple Git-117)

node: v11.15.0

npm: 6.14.4

yeoman: 3.1.1

Docker version 18.06.1-ce, build e68fc7a

docker-compose version 1.22.0, build f46880f

INFO! Congratulations, JHipster execution is complete!

Love JHipster? Please consider supporting our collective: 👉 https://opencollective.com/generator-jhipster/donate

nicolas63 commented 4 years ago

Have you many-to-many relation in your jdl ?

amatosg commented 4 years ago

yes, only one.

nicolas63 commented 4 years ago

We have an issue with jdl and many-to-many (https://github.com/jhipster/jhipster-dotnetcore/issues/153) But you can generate this entity with jhipster entity YourEntity

amatosg commented 4 years ago

it only generated the json entities in the .jhipster folder though.

nicolas63 commented 4 years ago

can you show me logs ?

amatosg commented 4 years ago

this is the full log then executing the import command: https://pastebin.com/WDSaUYNV

nicolas63 commented 4 years ago

I'm going to work on it. A workaround was to remove many-to-many in jdl and generate it manually with jhipster entity command

nicolas63 commented 4 years ago

@amatosg Can you try with #224 ?

amatosg commented 4 years ago

did you lease it? How can I test it?

nicolas63 commented 4 years ago

you can clone my fork(master branch) and use npm link to run local version. This step is describe in the readme (Running local Blueprint version for development)

ivanmonteiro commented 4 years ago

@nicolas63 I was also experiencing this error. I tested this and can confirm that this error does not occur with the fix that you provided (#224). I experienced a little issue with multiple many-to-many relationships defined in jdl and opened issue #228 - basically all JoinedEntity classes are generated with the exact same code

nicolas63 commented 4 years ago

Thank you for your feedback. I have see #228 but I haven't looked at the problem yet.