Generator-jhipster: Upgrade to Major version: ERROR! TypeError: Cannot read property 'map' of undefined

Created on 20 Feb 2020  Â·  8Comments  Â·  Source: jhipster/generator-jhipster

Overview of the issue

I'm doing an upgrade from 5.8.2

Reproduce the error

Having the .yo-rc.json file in an empty director will reproduce the error.

JHipster Version(s)

Was 5.8.2, upgrading to 6.7.1

JHipster configuration
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.foo.bar.gateway"
    },
    "jhipsterVersion": "5.8.2",
    "baseName": "fooBar",
    "packageName": "com.foo.bar.gateway",
    "packageFolder": "com/foo/bar/gateway",
    "serverPort": "7080",
    "authenticationType": "oauth2",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "oracle",
    "prodDatabaseType": "oracle",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "gradle",
    "enableSocialSignIn": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "applicationType": "gateway",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "clientPackageManager": "npm",
    "skipClient": true,
    "skipUserManagement": true,
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": []
  }
}
  • [x] Checking this box is mandatory (this is just to show you read everything)
area upgrade

Most helpful comment

It’s requiring a
"languages": []
I will create a PR for this one.

All 8 comments

@asgh-mh : Can I have some more information on how you encountered this error? So you have the project given by the .yo-rc.json file and then you upgraded it to v6.7.1 using jhipster upgrade?

Yes, exactly. And when I did that I got that error. I then tried to figure out the problem and could not, but eventually figured out that simply having that .yo-rc.json file was enough to reproduce it so I hope you guys know what the problem is.

Okay, thanks. I've recreated your error. The upgrade you are trying to do is across major versions spanning development done for more than a year. What I would suggest is first upgrade to v6.0.0, then upgrade to something like, v6.4.0 and then upgrade to v6.7.1. I didn't dive deeply on why the error occurs exactly; but this step by step upgrade works.

In our upgrade page, under Specific steps on first upgrade it is mentioned that if you are updating from an old version its better to upgrade gradually. :smile:

I am closing this issue as I've reproduced this error and verified that the step by step upgrade process works; if you encounter any further errors please feel free to let us know :smile:

I tried your advice:

jhipster upgrade --target-version 6.0.0

```
INFO! Using JHipster version installed globally
INFO! Executing jhipster:upgrade
INFO! Options: targetVersion: 6.0.0, from-cli: true, target-version: 6.0.0
Welcome to the JHipster Upgrade Sub-Generator
This will upgrade your current application codebase to the latest JHipster version
No blueprints detected, skipping check of last blueprint version
Upgrading to the target JHipster version: 6.0.0

.... Skipping some lines
....

Installing generator-jhipster 6.0.0 locally
info npm install [email protected] --save-dev --no-package-lock --ignore-scripts
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

  • [email protected]
    added 17 packages from 24 contributors, removed 22 packages, updated 10 packages and audited 3798 packages in 15.738s

7 packages are looking for funding
run npm fund for details

found 11 vulnerabilities (1 moderate, 9 high, 1 critical)
run npm audit fix to fix them, or npm audit for details
✔ Installed [email protected]
Skipping blueprint update since no blueprint has been detected
ERROR! TypeError: Cannot read property 'map' of undefined
````

I had to also install generator v5.8.2 before doing this which I forgot to mention. So could you first do npm install -g [email protected] and then do jhipster upgrade --target-version 6.0.0 please ?

This is with the assumption that your project is already generated using v5.8.2 with the above provided .yo-rc.json file. Furthermore make sure to revert any changes in the repository if you have any before doing the upgrade since your previous try might have caused some files to upgrade (including the .yo-rc.json file). Just get it back to the original state you began with before trying this again. :smile:

upgrading to a major version is really complex, as you probably added specific code, so it's completely normal that the upgrade doesn't work.

You need to do the upgrade manually, and check each new line of code

Not sure we can help much here.
@SudharakaP I let you close the ticket if you think there's nothing we can do here

It’s requiring a
"languages": []
I will create a PR for this one.

I can confirm that adding "languages": [] fixes this.

Re: #11350 I guess it's not practical to backport this to prior releases? (It's not really a big deal, I can just add it to the .yo-rc.json file.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dronavallisaikrishna picture dronavallisaikrishna  Â·  3Comments

pascalgrimaud picture pascalgrimaud  Â·  4Comments

marcelinobadin picture marcelinobadin  Â·  3Comments

tomj0101 picture tomj0101  Â·  3Comments

SudharakaP picture SudharakaP  Â·  3Comments