D.Dinger
D.Dinger

Reputation: 71

Update of jhipster generator won't work

Jhipster generator says that I should install the update:

JHipster update available: 4.5.2 (current: 4.3.0)

If I try to run yarn global upgrade generator-jhipster as suggested, everything works fine.

success Saved 1 new dependency.
└─ [email protected]
warning No license field
✨  Done in 3.18s.

But if I try to generate a new project, I get the same update message again. Would appreciate any help on this.

Upvotes: 2

Views: 1436

Answers (3)

Guillaume Georges
Guillaume Georges

Reputation: 4020

I solved the exact same issue by :

  • going to C:\Users\%yourLogin%\AppData\Local\Yarn\bin and deleting these two files : jhipster and jhipster.cmd

  • running : yarn global add generator-jhipster

Upvotes: 1

sevago
sevago

Reputation: 11

A simple solution is to re-install generator-jhipster:

yarn global remove generator-jhipster

then

yarn global add generator-jhipster

Upvotes: 1

David Steiman
David Steiman

Reputation: 3145

There are several problems could happen here. In general, handling NPM/yarn modules depend very on a proper installation of npm and yarn. In e.g. I often ran into different issues, as I installed yo and generator-jhipster using npm, while used them later in yarn. A clean install of npm, then yarn, then yarn global add yo and yarn global add generator-jhipster solved my issues.

The first thing I would check, is if you get the "update available" message in other directories, rather the project root. JHipster always places a copy of the currently used version to the project as you generate it the first time, to make sure you don't break your code when using newer JHipster versions for new projects, but still use yo jhipster:entity and other post-generation commands.

Another thing is if you use jhipster instead of yo jhipster. There is an issue that the JHipster client doesn't recognize a newer version, while yo jhipster does.

if all that doesn't help: if the "nice" ways of solving your issue don't help, there is a "crowbar style" solution I can suggest:

  • in a separate directory, run git clone https://github.com/jhipster/generator-jhipster
  • to specify the target version, check out a tag by git checkout v4.5.2
  • run yarn link
  • in your project root, run yarn link generator-jhipster

this will definitely will link the correct version into your project

Upvotes: 0

Related Questions