Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

JHipster Application without server side + JDL with microservices : NPM build is broken #416

Open
1 task done
juliensadaoui opened this issue Dec 17, 2019 · 2 comments
Open
1 task done

Comments

@juliensadaoui
Copy link
Member

Overview of the issue

I have generated a new application without server side. When i'm trying to import a JDL file with entities linked at a microservice, it fails with the following information.

INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing import-jdl ./crm.jh
INFO! Options: force: true, from-cli: true, inline:
INFO! Found .yo-rc.json on path. This is an existing app
INFO! The JDL is being parsed.
INFO! Found entities: Product, Customer, ProductOrder, OrderItem.
INFO! The JDL has been successfully parsed
INFO! Generating 4 entities.

Found the .jhipster/Product.json configuration file, entity can be automatically generated!


The entity Product is being updated.


Found the .jhipster/Customer.json configuration file, entity can be automatically generated!


The entity Customer is being updated.


Found the .jhipster/ProductOrder.json configuration file, entity can be automatically generated!


The entity ProductOrder is being updated.


Found the .jhipster/OrderItem.json configuration file, entity can be automatically generated!


The entity OrderItem is being updated.

   create src/main/webapp/app/entities/product/product.component.html
   create src/main/webapp/app/entities/product/product-detail.component.html
   create src/main/webapp/app/entities/product/product-update.component.html
   create src/main/webapp/app/entities/product/product-delete-dialog.component.html
    force src/main/webapp/app/layouts/navbar/navbar.component.html
   create src/main/webapp/app/entities/customer/customer.component.html
   create src/main/webapp/app/entities/customer/customer-detail.component.html
   create src/main/webapp/app/entities/customer/customer-update.component.html
   create src/main/webapp/app/entities/customer/customer-delete-dialog.component.html
   create src/main/webapp/app/entities/product/product.module.ts
   create src/main/webapp/app/entities/product/product.route.ts
   create src/main/webapp/app/shared/model/product.model.ts
   create src/main/webapp/app/entities/product/product.component.ts
   create src/main/webapp/app/entities/product/product-detail.component.ts
   create src/main/webapp/app/entities/product/product.service.ts
   create src/main/webapp/app/entities/product/product-update.component.ts
   create src/main/webapp/app/entities/product/product-delete-dialog.component.ts
   create src/test/javascript/spec/app/entities/product/product-detail.component.spec.ts
   create src/test/javascript/spec/app/entities/product/product.component.spec.ts
   create src/test/javascript/spec/app/entities/product/product.service.spec.ts
   create src/test/javascript/spec/app/entities/product/product-update.component.spec.ts
   create src/test/javascript/spec/app/entities/product/product-delete-dialog.component.spec.ts
    force src/main/webapp/app/entities/entity.module.ts
   create src/main/webapp/app/shared/model/enumerations/size.model.ts
   create src/main/webapp/i18n/en/size.json
   create src/main/webapp/app/entities/product-order/product-order.component.html
   create src/main/webapp/app/entities/product-order/product-order-detail.component.html
   create src/main/webapp/i18n/en/product.json
   create src/main/webapp/app/entities/product-order/product-order-update.component.html
   create src/main/webapp/app/entities/product-order/product-order-delete-dialog.component.html
    force src/main/webapp/i18n/en/global.json
   create src/main/webapp/app/entities/customer/customer.module.ts
   create src/main/webapp/app/entities/customer/customer.route.ts
   create src/main/webapp/app/shared/model/customer.model.ts
   create src/main/webapp/app/entities/customer/customer.component.ts
   create src/main/webapp/app/entities/customer/customer-detail.component.ts
   create src/main/webapp/app/entities/customer/customer.service.ts
   create src/main/webapp/app/entities/customer/customer-update.component.ts
   create src/main/webapp/app/entities/customer/customer-delete-dialog.component.ts
   create src/test/javascript/spec/app/entities/customer/customer-detail.component.spec.ts
   create src/test/javascript/spec/app/entities/customer/customer.component.spec.ts
   create src/test/javascript/spec/app/entities/customer/customer.service.spec.ts
   create src/test/javascript/spec/app/entities/customer/customer-update.component.spec.ts
   create src/test/javascript/spec/app/entities/customer/customer-delete-dialog.component.spec.ts
   create src/main/webapp/app/shared/model/enumerations/gender.model.ts
   create src/main/webapp/app/entities/order-item/order-item.component.html
   create src/main/webapp/app/entities/order-item/order-item-detail.component.html
   create src/main/webapp/app/entities/order-item/order-item-update.component.html
   create src/main/webapp/i18n/en/gender.json
   create src/main/webapp/app/entities/order-item/order-item-delete-dialog.component.html
   create src/main/webapp/i18n/en/customer.json
   create src/main/webapp/app/entities/product-order/product-order.module.ts
   create src/main/webapp/app/entities/product-order/product-order.route.ts
   create src/main/webapp/app/shared/model/product-order.model.ts
   create src/main/webapp/app/entities/product-order/product-order.component.ts
   create src/main/webapp/app/entities/product-order/product-order-detail.component.ts
   create src/main/webapp/app/entities/product-order/product-order.service.ts
   create src/main/webapp/app/entities/product-order/product-order-update.component.ts
   create src/main/webapp/app/entities/product-order/product-order-delete-dialog.component.ts
   create src/test/javascript/spec/app/entities/product-order/product-order-detail.component.spec.ts
   create src/test/javascript/spec/app/entities/product-order/product-order.component.spec.ts
   create src/test/javascript/spec/app/entities/product-order/product-order.service.spec.ts
   create src/test/javascript/spec/app/entities/product-order/product-order-update.component.spec.ts
   create src/test/javascript/spec/app/entities/product-order/product-order-delete-dialog.component.spec.ts
   create src/main/webapp/app/shared/model/enumerations/order-status.model.ts
   create src/main/webapp/i18n/en/orderStatus.json
   create src/main/webapp/i18n/en/productOrder.json
   create src/main/webapp/app/entities/order-item/order-item.module.ts
   create src/main/webapp/app/entities/order-item/order-item.route.ts
   create src/main/webapp/app/shared/model/order-item.model.ts
   create src/main/webapp/app/entities/order-item/order-item.component.ts
   create src/main/webapp/app/entities/order-item/order-item-detail.component.ts
   create src/main/webapp/app/entities/order-item/order-item.service.ts
   create src/main/webapp/app/entities/order-item/order-item-update.component.ts
   create src/main/webapp/app/entities/order-item/order-item-delete-dialog.component.ts
   create src/test/javascript/spec/app/entities/order-item/order-item-detail.component.spec.ts
   create src/test/javascript/spec/app/entities/order-item/order-item.component.spec.ts
   create src/test/javascript/spec/app/entities/order-item/order-item.service.spec.ts
   create src/test/javascript/spec/app/entities/order-item/order-item-update.component.spec.ts
   create src/test/javascript/spec/app/entities/order-item/order-item-delete-dialog.component.spec.ts
   create src/main/webapp/app/shared/model/enumerations/order-item-status.model.ts
   create src/main/webapp/i18n/en/orderItemStatus.json
   create src/main/webapp/i18n/en/orderItem.json
Entity Product generated successfully.
Entity Customer generated successfully.
Entity ProductOrder generated successfully.

Running `webpack:build` to update client app

Entity OrderItem generated successfully.

> [email protected] webpack:build /Users/julien/Development/jhipster/issue/client-without-server
> npm run cleanup && npm run webpack:build:main


> [email protected] cleanup /Users/julien/Development/jhipster/issue/client-without-server
> rimraf build/resources/main/static/ build/resources/main/aot


> [email protected] webpack:build:main /Users/julien/Development/jhipster/issue/client-without-server
> npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal


> [email protected] webpack /Users/julien/Development/jhipster/issue/client-without-server
> node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"

Webpack: Starting ...
Starting type checking service...
Webpack: Starting ...

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

Webpack: Finished after 27.572 seconds.



 ERROR  Failed to compile with 3 errors                                                                                                                                                     0:27:55

These dependencies were not found:

* app/entities/crm/customer/customer.service in ./src/main/webapp/app/entities/product-order/product-order-update.component.ts
* app/entities/crm/product-order/product-order.service in ./src/main/webapp/app/entities/order-item/order-item-update.component.ts
* app/entities/crm/product/product.service in ./src/main/webapp/app/entities/order-item/order-item-update.component.ts

To install them, you can run: npm install --save app/entities/crm/customer/customer.service app/entities/crm/product-order/product-order.service app/entities/crm/product/product.service
   638 modules

ERROR in ./src/main/webapp/app/entities/product-order/product-order-update.component.ts
Module not found: Error: Can't resolve 'app/entities/crm/customer/customer.service' in '/Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/product-order'

ERROR in ./src/main/webapp/app/entities/order-item/order-item-update.component.ts
Module not found: Error: Can't resolve 'app/entities/crm/product-order/product-order.service' in '/Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item'

ERROR in ./src/main/webapp/app/entities/order-item/order-item-update.component.ts
Module not found: Error: Can't resolve 'app/entities/crm/product/product.service' in '/Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item'

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item/order-item-update.component.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item/order-item-update.component.ts(11,26):
TS2307: Cannot find module 'app/shared/model/crm/product.model'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item/order-item-update.component.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item/order-item-update.component.ts(12,32):
TS2307: Cannot find module 'app/entities/crm/product/product.service'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item/order-item-update.component.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item/order-item-update.component.ts(13,31):
TS2307: Cannot find module 'app/shared/model/crm/product-order.model'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item/order-item-update.component.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/order-item/order-item-update.component.ts(14,37):
TS2307: Cannot find module 'app/entities/crm/product-order/product-order.service'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/product-order/product-order-update.component.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/product-order/product-order-update.component.ts(13,27):
TS2307: Cannot find module 'app/shared/model/crm/customer.model'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/product-order/product-order-update.component.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/entities/product-order/product-order-update.component.ts(14,33):
TS2307: Cannot find module 'app/entities/crm/customer/customer.service'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/customer.model.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/customer.model.ts(1,31):
TS2307: Cannot find module 'app/shared/model/crm/product-order.model'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/order-item.model.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/order-item.model.ts(1,26):
TS2307: Cannot find module 'app/shared/model/crm/product.model'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/order-item.model.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/order-item.model.ts(2,31):
TS2307: Cannot find module 'app/shared/model/crm/product-order.model'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/product-order.model.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/product-order.model.ts(2,28):
TS2307: Cannot find module 'app/shared/model/crm/order-item.model'.

ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/product-order.model.ts
ERROR in /Users/julien/Development/jhipster/issue/client-without-server/src/main/webapp/app/shared/model/product-order.model.ts(3,27):
TS2307: Cannot find module 'app/shared/model/crm/customer.model'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/julien/.npm/_logs/2019-12-17T23_27_56_233Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack:build:main: `npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] webpack:build:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/julien/.npm/_logs/2019-12-17T23_27_56_290Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack:build: `npm run cleanup && npm run webpack:build:main`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] webpack:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/julien/.npm/_logs/2019-12-17T23_27_56_376Z-debug.log
INFO! Congratulations, JHipster execution is complete!
INFO! Congratulations, JHipster execution is complete!
INFO! Congratulations, JHipster execution is complete!
INFO! Congratulations, JHipster execution is complete!
Motivation for or Use Case

I would like to generate an angular application without server side.

Reproduce the error
  • Generate new jhipster application without server side
  • Import a JDL file with entities linked at a microservice
Suggest a Fix

Quick fix: I changed the applicationType option - gateway instead of monolith

JHipster Version(s)

generated with 6.5.1

JHipster configuration

Command: jhipster --skip-server --db sql --auth jwt

{
  "generator-jhipster": {
    "promptValues": {
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.5.1",
    "applicationType": "monolith",
    "baseName": "jhipster",
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "authenticationType": "jwt",
    "cacheProvider": "no",
    "databaseType": "sql",
    "devDatabaseType": "sql",
    "prodDatabaseType": "sql",
    "creationTimestamp": 1576624471664,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": ["en"],
    "blueprints": [],
    "skipServer": true
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory
entity Product {
    name String required
    description String
    price BigDecimal required min(0)
    size Size required
    image ImageBlob
}
enum Size {
    S, M, L, XL, XXL
}
entity Customer {
    firstName String required
    lastName String required
    gender Gender required
    email String required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/)
    phone String required
    addressLine1 String required
    addressLine2 String
    city String required
    country String required
}
enum Gender {
    MALE, FEMALE, OTHER
}
entity ProductOrder {
    placedDate Instant required
    status OrderStatus required
    code String required
    invoiceId String
}

enum OrderStatus {
    COMPLETED, PENDING, CANCELLED
}
entity OrderItem {
    quantity Integer required min(0)
    totalPrice BigDecimal required min(0)
    status OrderItemStatus required
}
enum OrderItemStatus {
    AVAILABLE, OUT_OF_STOCK, BACK_ORDER
}
relationship ManyToOne {
 OrderItem{product(name) required} to Product
}
relationship OneToMany {
   Customer{order} to ProductOrder{customer(email) required},
   ProductOrder{orderItem} to OrderItem{order(code) required} ,
}
service Product, Customer, ProductOrder, OrderItem with serviceClass
paginate Product, Customer, ProductOrder, OrderItem with pagination
microservice Customer, Product, ProductOrder, OrderItem with crm
Browsers and Operating Systemgit: 2.23.0

OS: macOS Catalina (10.15.1)

node: v12.13.0

npm: 6.13.4

yeoman: 3.1.1

  • Checking this box is mandatory (this is just to show you read everything)
@MathieuAA
Copy link
Member

Thanks @juliensadaoui, I'll look into your logs once I get some sleep :)

@MathieuAA
Copy link
Member

I think I've got it...
When one generates a microservice application, then the clientRootFolder option is set to the application's name. This is automatic because, well, nobody sets this option manually when designing app.
However here there's no application definition, just entities, relationships and options.
In your provided .yo-rc.json file, I see the application is a monolith. That's what JCore will read and remember.

Have you tried using the clientRootFolder option for your entities?

@MathieuAA MathieuAA removed the to test label Dec 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants