jhipster v7.9.0 got error when generate the project - jhipster

I was trying to create the project using the following .yo-rc.json file:
{
"generator-jhipster": {
"applicationType": "monolith",
"authenticationType": "jwt",
"baseName": "baby",
"blueprints": [],
"buildTool": "maven",
"cacheProvider": "ehcache",
"clientFramework": "angularX",
"clientPackageManager": "npm",
"clientTheme": "none",
"clientThemeVariant": "",
"creationTimestamp": 1659322452305,
"cypressAudit": false,
"cypressCoverage": true,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"devServerPort": 4200,
"dtoSuffix": "DTO",
"enableGradleEnterprise": false,
"enableHibernateCache": true,
"enableSwaggerCodegen": false,
"enableTranslation": true,
"entitySuffix": "",
"jhiPrefix": "jhi",
"jhipsterVersion": "7.9.0",
"jwtSecretKey": "ZDkzZDZjZmFiYjljYTU4YzQ3MzI1ZDlmMTkxMTZkZjVlMzg3OWVlNDgwNzY3ZmQ5ZjcyNmUzYmFmOTc2ODcwMGZlZjRhZTgwZTQ4MDkyMGMxZDcyOGNmNTI3ZTU1YmRkZDA2M2MxNjEwODcyZWJhYzdhZWMyNjJlZGJhNzY3MDY=",
"languages": ["en", "pt-br"],
"messageBroker": false,
"microfrontend": false,
"microfrontends": [],
"nativeLanguage": "en",
"otherModules": [],
"packageName": "com.mamazinha.baby",
"pages": [],
"prodDatabaseType": "postgresql",
"reactive": false,
"searchEngine": false,
"serverPort": "8080",
"serverSideOptions": [],
"serviceDiscoveryType": "no",
"skipCheckLengthOfIdentifier": false,
"skipFakeData": false,
"skipUserManagement": false,
"testFrameworks": ["cypress"],
"websocket": false,
"withAdminUi": true
}
}
I run the jhipster command on windows 10 at the powershell. I 've got the following error message:
PS C:\Users\Blog\Documents\Projects\_ERROR_v7.9.0_mamazinha-monolithic> npm run clean-www
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> baby#0.0.1-SNAPSHOT clean-www
> rimraf target/classes/static/app/{src,target/}
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Blog\Documents\Projects\_ERROR_v7.9.0_mamazinha-monolithic
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Blog\AppData\Local\npm-cache\_logs\2022-08-01T05_45_51_701Z-debug-0.log

The solution
It doesn't work if you run npm run clean-www command from windows powershell! After I run it using git bash on windows it all works out!
After that, I tried the hipster command at git bash and everything works fine!

Related

problem with running eslint with npm node js

eslint . --ext .js
Error: .eslintrc:
Environment key "es2021" is unknown
at Object.keys.forEach.id (Image api/node_modules/eslint/lib/shared/config-validator.js:169:19)
at Array.forEach (<anonymous>)
at validateEnvironment (Image api/node_modules/eslint/lib/shared/config-validator.js:163:30)
at validateConfigArray (Image api/node_modules/eslint/lib/shared/config-validator.js:334:9)
at CascadingConfigArrayFactory._finalizeConfigArray (Image api/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:417:13)
at CascadingConfigArrayFactory.getConfigArrayForFile (Image api/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:271:21)
at FileEnumerator._iterateFilesRecursive (Image api/node_modules/eslint/lib/cli-engine/file-enumerator.js:396:49)
at _iterateFilesRecursive.next (<anonymous>)
at FileEnumerator.iterateFiles (Image api/node_modules/eslint/lib/cli-engine/file-enumerator.js:251:49)
at iterateFiles.next (<anonymous>)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! image-api#1.0.0 lint: eslint . --ext .js
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the image-api#1.0.0 lint 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! /home/marwan/.npm/_logs/2022-01-10T23_00_43_567Z-debug.log
.eslintrc
{
"env": {
"browser": true,
"es2021": true
},
"parser": "#typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"#typescript-eslint"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-multiple-empty-lines": [
2,
{ "max": 1, "maxEOF": 0, "maxBOF": 0 }
],
"no-trailing-spaces": "error",
"import/no-extraneous-dependencies": 0
}
}
The environment es2021 was added with ESLint 8 (ESLint 7 does not have it). The error message is a hint that you are using an older version of ESLint.
Look into your package.json, update the ESLint version to >= 8, then run npm install.

I am not able to use jhipster microservice without registry. .yo-rc.json file

`{
"generator-jhipster": {
"promptValues": {
"packageName": "com.xyz.service",
"nativeLanguage": "en"
},
"jhipsterVersion": "5.0.0-beta.3",
"applicationType": "microservice",
"baseName": "MicroServiceStarterKit",
"packageName": "com.xyz.service",
"packageFolder": "com/xyz/service",
"serverPort": "8082",
"authenticationType": "jwt",
"cacheProvider": "hazelcast",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"jwtSecretKey": "token",
"enableTranslation": false,
"testFrameworks": [],
"jhiPrefix": "jhi",
"nativeLanguage": "en",
"languages": [
"en"
],
"clientPackageManager": "yarn",
"skipClient": true,
"skipUserManagement": true
}
}`
when I run ./mvnw command it shows application is running. The url http://localhost:8082 is not accessible and throws 404 error. When I use serviceDiscoveryType property as eureka it works fine and index.html open
When disabling service discovery in a microservice, the microservice uses a context-path. In your case, the microservice will be available at:
http://localhost:8082/MicroServiceStarterKit

Unable to login on my jhipster 4 project with uaa, a microservice and a gateway and running with consul

I've generated a jhipster 4 project with uaa, a microservice and a gateway and running with consul. All start well but i'm unable to login
Error:
Filter: Access Control: allowing access for /uaa/api/account, as no access control policy has been set up for service: uaa
Error during filtering
/uaa/api/account [HTTP/1.1 401 Unauthorized
...
com.netflix.zuul.exception.ZuulException: Forwarding error
Caused by: java.net.SocketTimeoutException: Read timed out
Here .yo-rc.json file for uaa server
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.mycompany.myapp",
"nativeLanguage": "fr"
},
"jhipsterVersion": "4.3.0",
"baseName": "uaa",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "9999",
"authenticationType": "uaa",
"hibernateCache": "hazelcast",
"clusteredHttpSession": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": "consul",
"buildTool": "maven",
"enableSocialSignIn": false,
"enableTranslation": true,
"applicationType": "uaa",
"testFrameworks": [
"gatling",
"cucumber"
],
"jhiPrefix": "jhi",
"skipClient": true,
"nativeLanguage": "fr",
"languages": [
"fr"
],
"clientPackageManager": "yarn"
}
}
Here .yo-rc.json file for my microservice
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.mycompany.myapp",
"nativeLanguage": "fr"
},
"jhipsterVersion": "4.3.0",
"baseName": "resource",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "8081",
"authenticationType": "uaa",
"uaaBaseName": "uaa",
"hibernateCache": "hazelcast",
"clusteredHttpSession": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": "consul",
"buildTool": "maven",
"enableSocialSignIn": false,
"jwtSecretKey": "1eada7e399535cfc724344c47d3dae65e47455a1",
"enableTranslation": true,
"applicationType": "microservice",
"testFrameworks": [
"gatling",
"cucumber"
],
"jhiPrefix": "jhi",
"skipClient": true,
"skipUserManagement": true,
"nativeLanguage": "fr",
"languages": [
"fr",
"en"
],
"clientPackageManager": "yarn"
}
}
Here .yo-rc.json file for my gateway
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.mycompany.myapp",
"nativeLanguage": "fr"
},
"jhipsterVersion": "4.3.0",
"baseName": "gateway",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "8080",
"authenticationType": "uaa",
"uaaBaseName": "uaa",
"hibernateCache": "hazelcast",
"clusteredHttpSession": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"messageBroker": false,
"serviceDiscoveryType": "consul",
"buildTool": "maven",
"enableSocialSignIn": false,
"clientFramework": "angular2",
"useSass": true,
"clientPackageManager": "yarn",
"applicationType": "gateway",
"testFrameworks": [
"gatling",
"cucumber",
"protractor"
],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "fr",
"languages": [
"fr",
"en"
]
}
}

I have to create same Jhipster yo.rc.json as in my old project

I am working on rebuild the same jhipster application as previous one bcoz old project are having some problems.
The problem is that, project was created in version 2.1.27 and I have to create the same kind of project in 3.8.0. So, jhipster question and answer pattern is changed and I am confused what to answer to that question.
For Example : I had xauth authentication in my previous app. but while building new jhipster app I dont see any such kind of authentication there are three options: HTTP,OAUTH2 and JWT. what should I have to select. Further more I will share my old yo.rc.JSON can anybuddy guild me correct answer to build new jhipster yo.rc file
{
"generator-jhipster": {
"baseName": "myApp",
"packageName": "com.myApp.app",
"packageFolder": "com/myApp/app",
"authenticationType": "xauth",
"hibernateCache": "no",
"clusteredHttpSession": "no",
"websocket": "no",
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": "no",
"useSass": false,
"buildTool": "maven",
"frontendBuilder": "grunt",
"javaVersion": "7",
"enableTranslation": false,
"rememberMeKey": "c1a3776920bbeb376eeecd42e91cccdeaoada010"
}
}
You should use JWT authentication. This was changed in 3.0 https://github.com/jhipster/generator-jhipster/commit/2f017636700790aa5b38554da71fc27801b67cd3
Regarding migration of your full yo-rc.json, you have to try by yourself by generating new projects.
Few hints:
"frontendBuilder": "grunt", <-- we only support gulp now
"javaVersion": "7", <-- we only support java 8
"enableTranslation": false, <-- probably need to list languages
"rememberMeKey": "c1a3776920bbeb376eeecd42e91cccdeaoada010" <-- secret key maybe
{
"generator-jhipster": {
"jhipsterVersion": "3.8.0",
"baseName": "myApp",
"packageName": "com.myApp.app",
"packageFolder": "com/myApp/app",
"serverPort": "8081",
"authenticationType": "JWT",
"hibernateCache": "no",
"clusteredHttpSession": false,
"websocket": "spring-websocket",
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"messageBroker": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"useSass": false,
"applicationType": "monolith",
"testFrameworks": [
"gatling"
],
"jhiPrefix": "jhi",
"enableTranslation": false
}
}
{
"generator-jhipster": {
"jhipsterVersion": "3.8.0",
"baseName": "myApp",
"packageName": "com.myApp.app",
"packageFolder": "com/myApp/app",
"serverPort": "8081",
"authenticationType": "JWT",
"hibernateCache": "no",
"clusteredHttpSession": false,
"websocket": "spring-websocket",
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"messageBroker": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"useSass": false,
"applicationType": "monolith",
"testFrameworks": [
"gatling"
],
"jhiPrefix": "jhi",
"enableTranslation": false
}
}

Getting 404 from microservices in gateway front

I've created a microservices architecture following jhipster instructions. I have a gateway, the registry and a simple microservice. After that i've called the entity sub-generator in the gateway to generate the front-end code for the microservice.
After doing that, I can propertly create/list/update the microservice resources from the Administration-API section in the gateway, but in the 'Entities' section (via front-end) i'm getting a 404 in all the microservices requests.
The 3 apps are running in dev profile, and the jwt secret token is the same for all of them: my-secret-token-to-change-in-production. I have not touched the config ymls.
¿What could be the problem? 404 is not a security problem ¿Isn't it? ¿Maybe the problem is the proxy? I'm behind a proxy.
I follow the Julien Dubois video, https://www.youtube.com/watch?v=dOO-8cAKDu8 and he just re-generate the entity in the gateway to access the front-end via 'Entities' menu (minute 33 aprox).
Thank you!
Gateway generator options:
{
"generator-jhipster": {
"jhipsterVersion": "3.6.1",
"baseName": "testgw",
"packageName": "com.test.app",
"packageFolder": "com/test/app",
"serverPort": "8080",
"authenticationType": "jwt",
"hibernateCache": "hazelcast",
"clusteredHttpSession": "no",
"websocket": "no",
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"buildTool": "maven",
"jwtSecretKey": "92bc8dd1e1cb0aacacfebe994abfb472862c512d",
"useSass": true,
"applicationType": "gateway",
"testFrameworks": [
"gatling",
"cucumber",
"protractor"
],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "es",
"languages": [
"es",
"en"
]
}
}
Microservice generator options:
{
"generator-jhipster": {
"jhipsterVersion": "3.6.1",
"baseName": "patient",
"packageName": "com.test.app",
"packageFolder": "com/test/app",
"serverPort": "8081",
"authenticationType": "jwt",
"hibernateCache": "hazelcast",
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"buildTool": "maven",
"jwtSecretKey": "f9e757eb9259f0cfd8886bb08beda392463a4391",
"enableTranslation": true,
"applicationType": "microservice",
"testFrameworks": [
"gatling",
"cucumber"
],
"jhiPrefix": "jhi",
"skipClient": true,
"skipUserManagement": true,
"nativeLanguage": "es",
"languages": [
"es",
"en"
]
}
}

Resources