As we have basically 4 duplicate tickets on the JHipster upgrade sub-generator, I'm closing #5881 #5869 #5811 #5649 in favor of this new "meta ticket".
It's basically all the same issue: on some systems, the upgrade sub-generator cannot update the JHipster version. Typically, this is because it doesn't have the right to do. Then, there are various other issues depending on how it was installed.
This is why this failing for a lot of people, with different error messages depending on their own configuration and how they installed JHipster. And we can't always reproduce as it depends on our own setup.
This was mostly triggered by the use of Yarn: this adds one more installation mechanism, and it depends on how Yarn was installed.
There is also the issue of people upgrading their JHipster version globally, and then the sub-generator gets stuck with that global version.
-> I'm not sure this is true for everyone, so here is how to test this: say you are using JHipster 4.5.1, do a "jhipster upgrade". You will have a commit telling the application was re-generated with JHipster 4.5.1 (in the commit message). Have a look in the commit, if it's in fact generated with JHipster 4.5.2 (you can see it in package.json), then you have the issue of a global JHipster installation that you can't modify
This is so complex, and doing an upgrade isn't such a big deal to do manually, that I'm considering removing this sub-generator (cc @lordlothar99 as you coded this originally).
We just don't have the time to work on this -> would someone be interested in taking this ticket?
Agree 100% with you. But I would really hate to remove this but then if we cannot maintain it we dont have a choice. Since we now have a CLI we have more freedom now so if someone is interested to fix this or find a simpler solution that would be great. Ofcourse there are many ways in which we can make it work but we just dont have the time to spend on it
Me personally has never used the sub generator (maybe because of my development setup). I always do the update manually, so removing it would be totally ok for me.
I've used this sub generator quite a bit and it's made it easy for me to easily maintain tutorials over several months, rather than having to re-write them for the latest release.
I haven't experienced an issue where the JHipster version can't be upgraded. Does that only happen on particular operating systems? I haven't seen it on macOS Sierra.
Another (related) issue comes from the CLI:
I'm able to confirm that this sub generator did NOT work for me when trying to upgrade from 4.5.2 to 4.5.3.
The upgrade sub-generator helped me a lot aligning to the latest jhipter.
I stuck at JHipster 4.5.1 on my Windows and Linux machine for more than one week, and following the clues @jdubois provided, I can reproduce the issue as:
yarn global add generator-jhipsterjhipster upgradejhipster_upgrade branch is identical to the following commit Generated with JHipster 4.5.3, all code generated in both commits were generated by the global Jhipster 4.5.3. Hence nothing different to be merged into master!Then I tried to downgrade the global jhipster:
yarn global remove generator-jhipster & yarn globa add [email protected]jhipster upgradejhipster_upgrade were all generated using JHipster 4.5.1. Still failed to generate diff to be take to master.To prevent the global jhipster dominate the local code generation, I found a workaround:
yarn global remove generator-jhipsteralias jhipster=./node_modules/.bin/jhipster or export PATH=$(npm bin):$PATHjhipster upgrade , then things finally goes well as expected!I just tried the steps you outlined in 3: remove generator-jhipster from yarn global install, export PATH=$(npm bin):$PATH, then running yo jhipster:upgrade.
It seemed to work, but in the end, the only change made on my master branch is versions changed in yarn.lock.
± which jhipster
/Users/mraible/dev/21-points/node_modules/.bin/jhipster
[mraible:~/dev/21-points] master ± yo jhipster:upgrade
Welcome to the JHipster Upgrade Sub-Generator
This will upgrade your current application codebase to the latest JHipster version
Looking for latest generator-jhipster version...
New generator-jhipster version found: 4.5.3
Git repository detected
Created branch jhipster_upgrade
Cleaned up directory
Installing JHipster 4.5.2 locally
Installed [email protected]
Regenerating app with jhipster 4.5.2...
Successfully regenerated app with jhipster 4.5.2
Committed with message "Generated with JHipster 4.5.2"
Checked out branch "master"
Current code recorded as generated with version 4.5.2
Updating generator-jhipster to 4.5.3 . This might take some time...
Updated generator-jhipster to version 4.5.3
Checked out branch "jhipster_upgrade"
Cleaned up directory
Regenerating app with jhipster 4.5.3...
Successfully regenerated app with jhipster 4.5.3
Committed with message "Generated with JHipster 4.5.3"
Checked out branch "master"
Merging changes back to master...
Merge done!
Installing dependencies, please wait...
Upgraded successfully. Please now fix conflicts if any, and commit!
[mraible:~/dev/21-points] master(+12/-26,4) 4m52s ± git status
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: yarn.lock
no changes added to commit (use "git add" and/or "git commit -a")
@mraible Would you please start over again with jhipster upgrade instead of yo jhipster:upgrade?
And you can check the content of package.json at commit "Generated with JHipster 4.5.2" and "Generated with JHipster 4.5.3".
@tan9 I tried using jhipster upgrade and it does work. I believe yo jhipster:upgrade might've too because I had the same yarn.lock issue as above.
Yep, just confirmed that yo jhipster:upgrade did indeed work on macOS Sierra 10.12.5. I upgraded from 4.5.2 to 4.5.3.
On my side, I tried 4.5.2 to 4.5.3 and failed. With jhipster upgrade. This happens
Welcome to the JHipster Upgrade Sub-Generator
This will upgrade your current application codebase to the latest JHipster version
Looking for latest generator-jhipster version...
New generator-jhipster version found: 4.5.3
Git repository detected
Updating generator-jhipster to 4.5.3 . This might take some time...
Updated generator-jhipster to version 4.5.3
events.js:182
throw er; // Unhandled 'error' event
^
Error: ERROR! Unable to checkout branch jhipster_upgrade:
error: Your local changes to the following files would be overwritten by checkout:
package.json
Please commit your changes or stash them before you switch branches.
Aborting
at Environment.error (node_modules/yeoman-environment/lib/environment.js:89:38)
at constructor.error (node_modules/generator-jhipster/generators/generator-base.js:1514:18)
at gitExec (node_modules/generator-jhipster/generators/upgrade/index.js:60:34)
at node_modules/shelljs/src/exec.js:204:9
at ChildProcess.exithandler (child_process.js:259:5)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:887:16)
at Socket.stream.socket.on (internal/child_process.js:340:11)
at emitOne (events.js:115:13)
Which seems to be
package.jsonpackage.json is modified locallyNo one is having this?
I'd suggest trying to delete your local jhipster_upgrade branch first.
git branch -D jhipster_upgrade
Am I now supposed to get it forever to simplify merge?
But, indeed, deleting the branch worked
May be we should add in a step to delete the branch if it exists already
On Fri, 16 Jun 2017, 6:02 pm Henri Tremblay, notifications@github.com
wrote:
But, indeed, deleting the branch worked
—
You are receiving this because you commented.Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/5883#issuecomment-309065567,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF4zLIjPuHz35xZ8l6yy8Ea6q98-Yks5sEqcFgaJpZM4Nxnwo
.
If the branch is indeed not historically needed, yes we should delete it.
@mraible , @deepu105 I encountered the same issue as @henri-tremblay , and I overcame the issue by just commit the changed package.json or just reset it. And start over the jhipster upgrade without deleting the jhipster_upgrade branch.
As the error message said:
Error: ERROR! Unable to checkout branch jhipster_upgrade:
error: Your local changes to the following files would be overwritten by checkout:
package.json
What happened actually is the version of ng-jhipster in package.json was updated accidentally in the source branch rather the in the jhipster_upgrade branch.
I tried to commit and relaunch. Didn't work.
In my case it was really the generator-jhipster version that was updated in
package.json.
ï¼ henri-tremblay What does "didn't worked" mean?
Is there any error messages, and what's the git branch and status after fail upgrading?
@tan9 Sorry. I don't remember. It is possible that I've ended up with a modified yarn.lock but no nothing migrated at all. I was in the master branch. I know, this isn't really helpful. It's not in my shell history anymore.
I can upgrade my project from 4.5.4 to 4.5.5 by executing:
$ export PATH=node_modules/.bin/:$PATH
$ jhipster upgrade --with-entities
$ git commit -a -m "Upgraded JHipster to 4.5.5."
$ jhipster upgrade --with-entities
@henri-tremblay Would you please remove the entire jhipster_upgrade and run again?
As I said, removing the branch did work.
I created a PR. I fix some issues in _generate function and the sequence of default steps.
I tested upgrade from 4.4.0 and 4.5.2 to 4.5.5.
There is an issue, when you add other dependencies to the project.
Test scenario:
yarn add ng2-formio and modify some code.jhipster upgradeProblem:
Almost thing work well until install step. Because there is conflict in package.json file then yarn command will be failed.
Fix this issue, of course.
yarn add ng2-formio and modify some code.jhipster upgradePR #5966
Prompt a warning message and wait until the user resolve the conflict package.json then continue remain steps.
4.5.3
.yo-rc.json file generated in the root folder{
"generator-jhipster": {
"promptValues": {
"packageName": "com.example.jhipster",
"nativeLanguage": "en"
},
"jhipsterVersion": "4.4.0",
"baseName": "jhipster",
"packageName": "com.example.jhipster",
"packageFolder": "com/example/jhipster",
"serverPort": "8080",
"authenticationType": "jwt",
"hibernateCache": "ehcache",
"clusteredHttpSession": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": "eureka",
"buildTool": "maven",
"enableSocialSignIn": false,
"jwtSecretKey": "3c212f5b83b803075e927d1032f4a74e54db6898",
"clientFramework": "angular2",
"useSass": false,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"testFrameworks": [
"cucumber"
],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "en",
"languages": [
"en",
"vi"
]
}
}
entityName.json files generated in the .jhipster directoryls: no such file or directory: .jhipster/*.json
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
git version 2.13.1
node: v8.1.2
npm: 5.0.3
bower: 1.8.0
gulp:
[10:07:19] CLI version 3.9.1
yeoman: 1.8.5
yarn: 0.24.6
Docker version 17.03.1-ce, build c6d412e
docker-compose version 1.11.2, build dfed245
entityName.json files generated in the .jhipster directoryMac OS X Sierra 10.12.5
iTerm 2 + fish shell
@jdubois could you please give me some comments on the above issue.
xxxxxxx@x53s-mint ~/projects/colony $ ./gradlew
:cleanResources
:bootBuildInfo
:bower
:nodeSetup SKIPPED
:gulpConstantDev
/home/amfibia/projects/colony/node_modules/node-sass/lib/binding.js:13
throw new Error(errors.unsupportedEnvironment());
^
Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (57)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.12.2
at module.exports (/home/amfibia/projects/colony/node_modules/node-sass/lib/binding.js:13:13)
at Object.
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.
:gulpConstantDev FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':gulpConstantDev'.
Process 'command 'node'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
What should I do to save it ?
@oaj could you follow the issue template and give more information. I would like to help.
3.10.0 to 4.6.2 is a big big jump...
@oaj When you zip/unzip files you lose permissions on Linux so that might be the cause of the issue. Try running yarn and yarn add -f node-sass. But please next time use stack overflow for those kind of requests.
@PierreBesson - You nailed it, now I can build the 3.10.0 again - Thank you very much. Also thanks to @tientq for your willingness to help out.
@pascalgrimaud - I know - I was focused on the coding all the time. I actually spend a few days resolving the merge conflicts - even though the building of the dependencies failed. The two days of works is saved and I think I can us it for a manual upgrade.
@oaj : yes, manually upgrade is better, because the 4.0.0 introduced some breaking changes for you:
See details here: https://jhipster.github.io/2017/02/02/jhipster-release-4.0.0.html
I did a manual upgrade according to the release notes, without upgrading my entities at first. And I let 'jhipster' overwrite everything. When i ran ./gradlew I got 7 compile errors in the files under /config
`amfibia@x53s-mint ~/projects/colony $ ./gradlew
Task :compileJava
/home/amfibia/projects/colony/src/main/java/net/amfibia/colony/config/SecurityConfiguration.java:67: error: reference to AjaxAuthenticationSuccessHandler is ambiguous
public AjaxAuthenticationSuccessHandler ajaxAuthenticationSuccessHandler() {
^
both class io.github.jhipster.security.AjaxAuthenticationSuccessHandler in io.github.jhipster.security and class net.amfibia.colony.security.AjaxAuthenticationSuccessHandler in net.amfibia.colony.security match
/home/amfibia/projects/colony/src/main/java/net/amfibia/colony/config/SecurityConfiguration.java:72: error: reference to AjaxAuthenticationFailureHandler is ambiguous
public AjaxAuthenticationFailureHandler ajaxAuthenticationFailureHandler() {
^
both class io.github.jhipster.security.AjaxAuthenticationFailureHandler in io.github.jhipster.security and class net.amfibia.colony.security.AjaxAuthenticationFailureHandler in net.amfibia.colony.security match
/home/amfibia/projects/colony/src/main/java/net/amfibia/colony/config/SecurityConfiguration.java:77: error: reference to AjaxLogoutSuccessHandler is ambiguous
public AjaxLogoutSuccessHandler ajaxLogoutSuccessHandler() {
^
both class io.github.jhipster.security.AjaxLogoutSuccessHandler in io.github.jhipster.security and class net.amfibia.colony.security.AjaxLogoutSuccessHandler in net.amfibia.colony.security match
/home/amfibia/projects/colony/src/main/java/net/amfibia/colony/config/SecurityConfiguration.java:82: error: reference to Http401UnauthorizedEntryPoint is ambiguous
public Http401UnauthorizedEntryPoint http401UnauthorizedEntryPoint() {
^
both class io.github.jhipster.security.Http401UnauthorizedEntryPoint in io.github.jhipster.security and class net.amfibia.colony.security.Http401UnauthorizedEntryPoint in net.amfibia.colony.security match
/home/amfibia/projects/colony/src/main/java/net/amfibia/colony/config/apidoc/SwaggerConfiguration.java:32: error: cannot find symbol
@Profile(Constants.SPRING_PROFILE_SWAGGER)
^
symbol: variable SPRING_PROFILE_SWAGGER
location: class Constants
/home/amfibia/projects/colony/src/main/java/net/amfibia/colony/config/apidoc/PageableParameterBuilderPlugin.java:30: error: cannot find symbol
@Profile(Constants.SPRING_PROFILE_SWAGGER)
^
symbol: variable SPRING_PROFILE_SWAGGER
location: class Constants
/home/amfibia/projects/colony/src/main/java/net/amfibia/colony/config/HerokuDatabaseConfiguration.java:15: error: cannot find symbol
@Profile(Constants.SPRING_PROFILE_HEROKU)
^
symbol: variable SPRING_PROFILE_HEROKU
location: class Constants
7 errors
`
Sorry, but i can upgrade my jhipster.... I did this:
first: yarn global remove generator-jhipster
then: yarn global add generator-jhipster,
result==>success Installed "[email protected]" with binaries:
- jhipster
Done in 6.87s.
But when i execute yo jhipster:
JHipster update available: 4.14.3 (current: 4.14.0)
Run yarn global upgrade generator-jhipster to update.
Its making me crazy....
thanks
Maybe you have installed generator-jhipster globally with both yarn and npm and your path is pointing to wrong one. Uninstall from both and install only with one. Also you did not give any information on your environment so we can't help you. If you are on Windows run where jhipster otherwise run which jhipster to know which command you execute. Last, don't use yo.
I faced the same problem. I tried all tips and nothing worked.
Upgrade smoothly completed once I commented out below line as showing in screenshots ../generator/upgrade/index.js
//this.error('Exiting process');


This is not recommend for all but worked for me and aware of other risks.
Hope it helps someone!
Most helpful comment
Agree 100% with you. But I would really hate to remove this but then if we cannot maintain it we dont have a choice. Since we now have a CLI we have more freedom now so if someone is interested to fix this or find a simpler solution that would be great. Ofcourse there are many ways in which we can make it work but we just dont have the time to spend on it