Generator-jhipster: React compile error on new project

Created on 18 Jan 2020  Â·  5Comments  Â·  Source: jhipster/generator-jhipster

Overview of the issue

I created a brand new JHipster application with these options

? Which *type* of application would you like to create? Monolithic application (recommended for simple pr
ojects)
? What is the base name of your application? jhtest
? What is your default Java package name? com.paulwaldo
? Do you want to use the JHipster Registry to configure, monitor and scale your application? No
? Which *type* of authentication would you like to use? JWT authentication (stateless, with a token)
? Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
? Which *production* database would you like to use? PostgreSQL
? Which *development* database would you like to use? H2 with disk-based persistence
? Do you want to use the Spring cache abstraction? Yes, with the Ehcache implementation (local cache, for
 a single node)
? Do you want to use Hibernate 2nd level cache? Yes
? Would you like to use Maven or Gradle for building the backend? Maven
? Which other technologies would you like to use? (Press <space> to select, <a> to toggle all, <i> to inv
ert selection)
? Which *Framework* would you like to use for the client? React
? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Default JHipster
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application English
? Please choose additional languages to install (Press <space> to select, <a> to toggle all, <i> to inver
t selection)
? Besides JUnit and Jest, which testing frameworks would you like to use? (Press <space> to select, <a> t
o toggle all, <i> to invert selection)
? Would you like to install other generators from the JHipster Marketplace? No

I then ran ./mvnw, which failed thusly

[INFO] Starting type checking service...
Webpack: Starting ...
[INFO] 
[INFO]    ✔ Compile modules
[INFO]    ✔ Build modules
[INFO]    ✔ Optimize modules
[INFO]    ✔ Emit files
[INFO] 
[INFO] Webpack: Finished after 20.718 seconds.
[INFO] 
[INFO]  ERROR  Failed to compile with 1 errors2:39:18 PM
[INFO] 
[INFO]  error  in /Users/paul/src/jhtest/src/main/webapp/app/modules/login/login.tsx
[INFO] 
[INFO] ERROR in /Users/paul/src/jhtest/src/main/webapp/app/modules/login/login.tsx(26,11):
[INFO] TS2339: Property 'from' does not exist on type '{} | { from: { pathname: string; search: string; }; }'.
[INFO] 
[INFO]    1025 modules
[INFO] 
[INFO] ERROR in /Users/paul/src/jhtest/src/main/webapp/app/modules/login/login.tsx
[INFO] ERROR in /Users/paul/src/jhtest/src/main/webapp/app/modules/login/login.tsx(26,11):
[INFO] TS2339: Property 'from' does not exist on type '{} | { from: { pathname: string; search: string; }; }'.
[INFO] npm ERR! code ELIFECYCLE
[INFO] npm ERR! errno 2
[INFO] 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"`
[INFO] npm ERR! Exit status 2
Motivation for or Use Case

A react project cannot be created

Reproduce the error
  • Create a new React JH Monolithic project with Postgres SQL, and disk-based H2 persistence
  • Run ./mvnw
  • login.tsx fails to compile, maven run aborts
Related issues
Suggest a Fix
JHipster Version(s)

6.6.0

JHipster configuration
paul-> jhipster info
INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:info
INFO! Options: from-cli: true
Welcome to the JHipster Information Sub-Generator

##### **JHipster Version(s)**

[email protected] /Users/paul/src/jhtest
└── [email protected]



##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**


<details>
<summary>.yo-rc.json file</summary>
<pre>
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.paulwaldo",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.6.0",
    "applicationType": "monolith",
    "baseName": "jhtest",
    "packageName": "com.paulwaldo",
    "packageFolder": "com/paulwaldo",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "react",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1579376152989,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": ["en"],
    "blueprints": []
  }
}

</pre>
</details>


##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**

<details>
<summary>JDL entity definitions</summary>

<pre>

</pre>
</details>


##### **Environment and Tools**

openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)

git version 2.24.0

node: v12.13.0

npm: 6.13.2

Docker version 18.09.2, build 6247962

docker-compose version 1.23.2, build 1110ad01

INFO! Congratulations, JHipster execution is complete!
paul-> cat .yo-rc.json
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.paulwaldo",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.6.0",
    "applicationType": "monolith",
    "baseName": "jhtest",
    "packageName": "com.paulwaldo",
    "packageFolder": "com/paulwaldo",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "MmMyMzE0NTJmZTQ2Nzg0YTk1NjFiMjc5ZTgwNWJmZjNmZjRmNTUxMGU2Y2Q0NThkOTQyMGZiZjkyMTY4YmE4NWYxZWFlYzMyODA1NDJkMGI5ZDkyYzMyOThlZmFmMDE4OTE1NWM1ODkwMTI2ZGQ4YjRkZGQxNTUwMjdjY2FhZDQ=",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "react",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1579376152989,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": ["en"],
    "blueprints": []
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System


macOS Mojave

  • [x] Checking this box is mandatory (this is just to show you read everything)
area react

Most helpful comment

It's an npm transitive dependency issue which is why it would affect new projects. I'm guessing it will be fixed upstream eventually. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/41674

Master is fixed by casting to any https://github.com/jhipster/generator-jhipster/pull/11117/commits/50973e295494d318eea8cbff36cb21f1871ff63e

To keep type checking, you can do npm install @types/[email protected] --save-dev (from a comment in the linked issue)

All 5 comments

It's an npm transitive dependency issue which is why it would affect new projects. I'm guessing it will be fixed upstream eventually. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/41674

Master is fixed by casting to any https://github.com/jhipster/generator-jhipster/pull/11117/commits/50973e295494d318eea8cbff36cb21f1871ff63e

To keep type checking, you can do npm install @types/[email protected] --save-dev (from a comment in the linked issue)

I was able to get around the issue simply by running ./mvnw again.

This is already fixed in our master branch as @ruddell pointed out, as well as a workaround has been suggested. Therefore I believe this can be closed. Feel free to reopen if there's any other issue we need to address. :smile:

EDIT: I've subscribed to the other thread (https://github.com/DefinitelyTyped/DefinitelyTyped/issues/41674). Will do a PR removing the any keyword once that's resolved.

To keep type checking, you can do npm install @types/[email protected] --save-dev (from a comment in the linked issue)

Your state is still (and always was) any if you pin to v4.7.3, so you don't _gain_ type checking by pinning to v.4.7.3. It's just that you don't have to cast to any.

Hey there - I was trying to use recent JHipster 6.6.0 and had same issue - workaround
https://github.com/jhipster/generator-jhipster/issues/11139#issuecomment-575938542 worked for me. But this could be bad for newbies :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RizziCR picture RizziCR  Â·  3Comments

Steven-Garcia picture Steven-Garcia  Â·  3Comments

chegola picture chegola  Â·  4Comments

marcelinobadin picture marcelinobadin  Â·  3Comments

DanielFran picture DanielFran  Â·  3Comments