问题
I have an existing project running on hipster 3.6.1, and I wanted to upgrade it to 3.12.2. I followed the process of upgrade described in jhipster website, but the hipster_upgrade branch generated still mentions the old version of the sub-generator.
Forced update using npm
While running the following command npm install -g generator-jhipster
, it shows me the following
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/usr/local/lib
└── generator-jhipster@3.12.2
Then I run yo jhipster --force --with-entities
, and this is the output:
Welcome to the JHipster Generator v3.6.1
Documentation for creating an application: https://jhipster.github.io/creating-an-app/
Application files will be generated in folder: /Users/bso/Projects/portal ______________________________________________________________________________
JHipster update available: 3.12.2 (current: 3.6.1)
Run npm install -g generator-jhipster to update.
______________________________________________________________________________
Reinstall jhipster generator
when doing npm i generator-jhipster
, the jhipster generator is updated to 3.12.2, but when reprocessing the upgrade, it comes back to 3.6.1.
Any clue on why this happens?
回答1:
The last comment added by @Jinna is resolving the issue. I found two jhipster generators in two different locations in my system, so that was the issue...
Steps to make it work: 1- npm link generatir-jhipster 2- delete the generator in the ~/.node_modules, the one that should remain is the one under /usr/loca/
回答2:
the reason why its hard to use an other version than the 3.6.1 is that jhipster saves itself into your node modules to ensure, you always work with the generator version you used to generate, to avoid bugs.
Look into the JHipster application upgrade guide to learn how to upgrade your app using
yo jhipster:upgrade
来源:https://stackoverflow.com/questions/41817394/how-to-upgrade-jhipster-sub-generator