generator-jhipster: Sometimes can't generate without prompt, even if there is file .yo-rc.json and other generation problems
Overview of the issue
When there is already a folder node_modules in the project, we can’t generate jhipster without prompt, even if there is the file .yo-rc.json, contrary to before.
It works randomly.
Motivation for or Use Case
Cause fails during local build for https://github.com/jhipster/generator-jhipster/pull/7484
More important, it cause problems if we want generate again the application for example for an upgrade.
Reproduce the error
#!/usr/bin/env bash
# -*- coding: UTF8 -*-
set -exu
PS4='\n\ntest@test:\w $ '
generatorDir="$HOME/generator-jhipster/"
export JHIPSTER="ngx-default"
export JHIPSTER_SAMPLES="$generatorDir""/travis/samples"
export APP_FOLDER="$JHIPSTER_SAMPLES""/$JHIPSTER""-sample"
bash "$generatorDir/travis/scripts/01-generate-entities.sh"
cd "$APP_FOLDER"
while true ; do
yarn init -y
yarn link "generator-jhipster"
cp "$JHIPSTER_SAMPLES""/$JHIPSTER""/.yo-rc.json" .
ls -la
jhipster --force --no-insight --skip-checks --with-entities \
--skip-git --skip-commit-hook
done
Explanations
An error occur started from 10071199b35c7940706d7173ccb12b22d8b28f4f from @MathieuAA (I’ve used git bisect).
At 10071199b35c7940706d7173ccb12b22d8b28f4f the output is:
Using JHipster version installed locally in current project's node_modules
Running default command
Executing jhipster:app
Options: force: true, insight: false, skipChecks: true, withEntities: true, skipGit: true, skipCommitHook: true, skip-checks: true, with-entities: true, skip-git: true, skip-commit-hook: true
██╗ ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗
██║ ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
██║ ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝
██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
https://www.jhipster.tech
Welcome to the JHipster Generator v5.0.0-beta.1
_______________________________________________________________________________________________________________
If you find JHipster useful consider supporting our collective https://opencollective.com/generator-jhipster
Documentation for creating an application: https://www.jhipster.tech/creating-an-app/
_______________________________________________________________________________________________________________
Application files will be generated in folder: /home/theuser/generator-jhipster/travis/samples/ngx-default-sample
This is an existing project, using the configuration from your .yo-rc.json file
to re-generate the project...
Installing languages: en, fr
events.js:183
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'endsWith' of undefined
at module.exports.getAngularAppName (/home/theuser/generator-jhipster/generators/generator-base.js:2098:56)
at module.exports.getConfig (/home/theuser/generator-jhipster/generators/entity/index.js:190:47)
at Object.<anonymous> (/home/theuser/generator-jhipster/node_modules/yeoman-generator/lib/index.js:399:25)
at /home/theuser/generator-jhipster/node_modules/run-async/index.js:25:25
at new Promise (<anonymous>)
at /home/theuser/generator-jhipster/node_modules/run-async/index.js:24:19
at self.env.runLoop.add.completed (/home/theuser/generator-jhipster/node_modules/yeoman-generator/lib/index.js:400:11)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
Actually (for bd0fe60f0a960537493a110c19f249584a94e0fd) the output is: EDIT: tomorrow I will improve the demonstration, because probably if you test at bd0fe60f0a960537493a110c19f249584a94e0fd you will not experience troubles.
test@test:~/generator-jhipster/travis/samples/ngx-default-sample $ ls -la
total 24
drwxr-xr-x 4 test users 4096 Jun 16 15:54 .
drwxr-xr-x 33 test users 4096 Jun 16 15:54 ..
drwxr-xr-x 2 test users 4096 Jun 16 15:54 .jhipster
drwxr-xr-x 2 test users 4096 Jun 16 15:55 node_modules
-rw-r--r-- 1 test users 99 Jun 16 15:55 package.json
-rw-r--r-- 1 test users 951 Jun 16 15:55 .yo-rc.json
test@test:~/generator-jhipster/travis/samples/ngx-default-sample $ jhipster --force
--no-insight --skip-checks --with-entities --skip-git --skip-commit-hook
Using JHipster version installed locally in current project's node_modules
Running default command
Executing jhipster:app
Options: force: true, insight: false, skipChecks: true, withEntities: true, skipGit:
true, skipCommitHook: true, skip-checks: true, with-entities: true, skip-git: true,
skip-commit-hook: true
██╗ ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗
██║ ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
██║ ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝
██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
https://www.jhipster.tech
Welcome to JHipster v5.0.0-beta.2
Application files will be generated in folder: /home/test/generator-jhipster/
travis/samples/ngx-default-sample
___________________________________________________________________________________
____________________________
Documentation for creating an application is at https://www.jhipster.tech/creating
-an-app/
If you find JHipster useful, consider sponsoring the project at https://opencollec
tive.com/generator-jhipster
___________________________________________________________________________________
____________________________
? Which *type* of application would you like to create?
❯ Monolithic application (recommended for simple projects)
Microservice application
Microservice gateway
JHipster UAA server (for microservice OAuth2 authentication)
JHipster configuration
See the .jhipster directory
Browsers and Operating System
Arch Linux
node v8.11.2
java 1.8.0_172
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 64 (64 by maintainers)
Commits related to this issue
- delete non unseful `yarn link "generator-jhipster"` that cause errors see https://github.com/jhipster/generator-jhipster/issues/7775#issuecomment-399394630 — committed to JulioJu/generator-jhipster by deleted user 6 years ago
- delete non unseful `yarn link "generator-jhipster"` that cause errors see https://github.com/jhipster/generator-jhipster/issues/7775#issuecomment-399394630 — committed to JulioJu/generator-jhipster by deleted user 6 years ago
And see you to the JHipster Conf. Have a good preparation 😃
I think no point wasting time here. We really need to discuss about switching back to NPM, Yarn is recently a PITA especially when it comes to developing with it
Thanks & Regards, Deepu
On Tue, Jun 19, 2018 at 8:26 AM Mathieu ABOU-AICHI notifications@github.com wrote:
@JulioJu : can you test this script without the
yarn link "generator-jhipster"?