Generator-jhipster: Not able to upgrade from version 3.9.1 to 4.0.0 or higher.

Created on 18 Nov 2019  ·  5Comments  ·  Source: jhipster/generator-jhipster

Overview of the issue

Trying to upgrade my very old version (3.9.1) to latest. After unsuccessful runs, decided to upgrade gradually and go up but still getting the follow error

Error jhipster:upgrade --target-version=4.3.0

ERROR! Something went wrong while updating generator! /usr/local/bin/jhipster -> /usr/local/lib/node_modules/generator-jhipster/cli/jhipster.js

[email protected] postinstall /usr/local/lib/node_modules/generator-jhipster/node_modules/core-js
node postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:

https://opencollective.com/core-js
https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

[email protected] postinstall /usr/local/lib/node_modules/generator-jhipster/node_modules/spawn-sync
node postinstall

[email protected] postinstall /usr/local/lib/node_modules/generator-jhipster/node_modules/yo
yodoctor

npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-doctor/lib/index.js:12
(async () => {
^
SyntaxError: Unexpected token (
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-doctor/lib/cli.js:3:1)
at Module._compile (module.js:570:32)
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8.10.0","npm":">=5.6.0"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8.10.0","npm":">=5.6.0"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8.0.0"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=10.0"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8.0"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=8"} (current: {"node":"6.9.1","npm":"6.13.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: yodoctor
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Motivation for or Use Case

Need to upgrade to latest version to be able to work with latest angular version

Reproduce the error

run command: yo jhipster:upgrade --target-version=4.3.0

Related issues

I think the following is a similar issue
https://github.com/jhipster/generator-jhipster/issues/5116

Suggest a Fix
JHipster Version(s)

My current version is 3.9.1

JHipster configuration
JHipster Version(s)
[email protected] /Users/david/git/AniBoneGateWay
└── [email protected] 

JHipster configuration, a .yo-rc.json file generated in the root folder
{
  "generator-jhipster": {
    "jhipsterVersion": "3.9.1",
    "baseName": "AniBoneGateWay",
    "packageName": "com.anibone",
    "packageFolder": "com/anibone",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "hazelcast",
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "prodDatabaseType": "mysql",
    "searchEngine": "elasticsearch",
    "messageBroker": false,
    "buildTool": "maven",
    "enableSocialSignIn": true,
    "jwtSecretKey": "xxxx",
    "useSass": true,
    "applicationType": "gateway",
    "testFrameworks": [
      "gatling",
      "cucumber",
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "serviceDiscoveryType": "eureka",
    "languages": [
      "en"
    ]
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

Business.json

{
  "fluentMethods": true,
  "relationships": [
    {
      "relationshipType": "one-to-one",
      "relationshipValidateRules": "required",
      "relationshipName": "addresss",
      "otherEntityName": "address",
      "otherEntityField": "id",
      "ownerSide": true,
      "otherEntityRelationshipName": "business"
    },
    {
      "relationshipType": "one-to-many",
      "relationshipValidateRules": "required",
      "relationshipName": "ranks",
      "otherEntityName": "rank",
      "otherEntityRelationshipName": "business"
    },
    {
      "relationshipType": "one-to-many",
      "relationshipValidateRules": "required",
      "relationshipName": "regions",
      "otherEntityName": "region",
      "otherEntityRelationshipName": "business"
    },
    {
      "relationshipType": "one-to-many",
      "relationshipValidateRules": "required",
      "relationshipName": "abDocs",
      "otherEntityName": "doc",
      "otherEntityRelationshipName": "business"
    },
    {
      "relationshipType": "one-to-one",
      "relationshipValidateRules": "required",
      "relationshipName": "abUsers",
      "otherEntityName": "abUser",
      "otherEntityField": "id",
      "ownerSide": true,
      "otherEntityRelationshipName": "business"
    },
    {
      "relationshipName": "personalZone",
      "otherEntityName": "personalZone",
      "relationshipType": "many-to-one",
      "otherEntityField": "id"
    },
    {
      "relationshipName": "businessCategory",
      "otherEntityName": "businessCategory",
      "relationshipType": "many-to-one",
      "otherEntityField": "id"
    }
  ],
  "fields": [
    {
      "fieldName": "name",
      "fieldType": "String"
    },
    {
      "fieldName": "workPhone",
      "fieldType": "String"
    },
    {
      "fieldName": "fax",
      "fieldType": "String"
    },
    {
      "fieldName": "workMail",
      "fieldType": "String"
    },
    {
      "fieldName": "siteUrl",
      "fieldType": "String"
    },
    {
      "fieldName": "description",
      "fieldType": "String"
    }
  ],
  "changelogDate": "20161015161323",
  "dto": "mapstruct",
  "pagination": "no",
  "service": "no",
  "entityTableName": "business",
  "microserviceName": "AniBoneMcrService"
}

SubTask.json

{
  "fluentMethods": true,
  "relationships": [
    {
      "relationshipName": "task",
      "otherEntityName": "task",
      "relationshipType": "many-to-one",
      "otherEntityField": "id"
    },
    {
      "relationshipType": "one-to-many",
      "relationshipValidateRules": "required",
      "relationshipName": "payments",
      "otherEntityName": "payment",
      "otherEntityRelationshipName": "subTask"
    },
    {
      "relationshipName": "subTaskRef",
      "otherEntityName": "subTaskRef",
      "relationshipType": "many-to-one",
      "otherEntityField": "id"
    }
  ],
  "fields": [
    {
      "fieldName": "subTaskStatus",
      "fieldType": "TaskStatusEnum",
      "fieldValues": "COMPLETED,INPROGRESS,NEW,NOT_ASSIGNED"
    },
    {
      "fieldName": "lastVisitDate",
      "fieldType": "LocalDate"
    },
    {
      "fieldName": "lastUpdateDate",
      "fieldType": "LocalDate"
    },
    {
      "fieldName": "name",
      "fieldType": "String"
    },
    {
      "fieldName": "userCost",
      "fieldType": "Integer"
    },
    {
      "fieldName": "note",
      "fieldType": "String"
    }
  ],
  "changelogDate": "20170825222944",
  "dto": "mapstruct",
  "pagination": "no",
  "service": "no",
  "microserviceName": "AniBoneMcrService",
  "entityTableName": "sub_task"
}
Browsers and Operating System

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.23.0

node: v6.9.1

npm: 6.13.0

bower: 1.8.4

gulp:
[20:02:37] CLI version 1.2.2
[20:02:37] Local version 3.9.1

yeoman: 1.8.5

Docker version 17.06.0-ce, build 02c1d87

docker-compose version 1.14.0, build c7bdf9e

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

OS: MacOs Sierra 10.12.6

  • [v] Checking this box is mandatory (this is just to show you read everything)
area wont-fix upgrade

All 5 comments

Error you pasted still shows that you're upgrading to JHipster 6.5.0:

npm WARN notsup Unsupported engine for [email protected]: wanted: 
{"node":">=8.10.0","npm":">=5.6.0"} (current: {"node":"6.9.1","npm":"6.13.0"})

It's probably because you use jhipstercommand which was found globally (/usr/local/bin/jhipster -> /usr/local/lib/node_modules/generator-jhipster/cli/jhipster.js) rather than locally in your project.

jhipster CLI was introduced in release 4.5.0 and so it did not exist in 3.9.1, try with yo jhipster:upgrade but I'm not sure target-version option existed at that time.

I looked at the upgrade generator source in 3.9.1 and it is very different from today.

I suspect that trying to use it will be really painful. Personally, I would rather generate a fresh 6.5 project from your .yo-rc.json file and your few entities and then report custom code into it manually, as it's a gateway most work should be in frontend.

Just saw that .yo-rc.json does not indicate client framework, so I suppose it's Angular 1, if true there's no upgrade path to Angular 2+. You also use SocialSignIn which is no longer supported.

If my above assumptions are right, I'm sorry but you can forget about using the upgrade generator.

As Gaël said, it's not possible to upgrade between 2 majors version...
You need to do it manually

I'm closing this as we can't do anything

Thank you for your replies

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pascalgrimaud picture pascalgrimaud  ·  4Comments

SudharakaP picture SudharakaP  ·  3Comments

shivroy121 picture shivroy121  ·  3Comments

sdoxsee picture sdoxsee  ·  4Comments

ahmedeldeeb25 picture ahmedeldeeb25  ·  3Comments