question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade issue - package.json changed on master branch

See original GitHub issue
Overview of the issue

Executing ‘yo jhipster:upgrade’ on a up-to-date project (ie. no changed file) I get the following error:

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

See below for details from the upgrade with --verbose

Motivation for or Use Case

It seems that the package.json is changed on master branch and not on the upgrade branch. All changes should happen in the branch and then after successful upgrade be merged to master (at least as I understood it?).

Reproduce the error

It has happened to me the last few versions (I usually upgrade for every version).

Note that I have two different projects that basically has the same starting point (ie. the same .jh files). Project #1 doesn’t have ANY custom code - I use that project to check/verify the upgrade (also, I get quite a good changelog what should be changed…). Project #2 is the project that contains all the custom code.

Project #1 was upgraded without problem. Project #2 got problem.

Related issues

Could not find any

Suggest a Fix
JHipster Version(s)

4.2.0

JHipster configuration

yo jhipster:info Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
recipe-4@0.3.0 /Users/lh/dev/projects/recipe4
├── UNMET PEER DEPENDENCY @angular/compiler@2.4.9
├── UNMET PEER DEPENDENCY @angular/core@2.4.9
├── generator-jhipster@4.3.0  invalid
├─┬ generator-jhipster-entity-audit@2.2.2
│ └── generator-jhipster@3.12.2
└── UNMET PEER DEPENDENCY zone.js@0.8.2

JHipster configuration, a .yo-rc.json file generated in the root folder
{
  "generator-jhipster": {
    "jhipsterVersion": "4.1.1",
    "baseName": "recipe4",
    "packageName": "se.receptgrottan",
    "packageFolder": "se/receptgrottan",
    "serverPort": "8080",
    "authenticationType": "session",
    "hibernateCache": "no",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "mongodb",
    "devDatabaseType": "mongodb",
    "prodDatabaseType": "mongodb",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSocialSignIn": true,
    "rememberMeKey": "foobar",
    "clientFramework": "angular2",
    "useSass": false,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "otherModules": [
      {
        "name": "generator-jhipster-entity-audit",
        "version": "2.2.2"
      }
    ],
    "enableTranslation": true,
    "nativeLanguage": "sv",
    "languages": [
      "sv",
      "en"
    ],
    "herokuAppName": "recipe1234"
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

FoodPlan.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "name",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldName": "urlPrefix",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        }
    ],
    "changelogDate": "20170222101924",
    "entityTableName": "food_plan",
    "dto": "no",
    "pagination": "pagination",
    "service": "serviceClass"
}

FoodPlanPeriod.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "startDate",
            "fieldType": "LocalDate",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldName": "url",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldName": "comment",
            "fieldType": "String"
        },
        {
            "fieldName": "urlPath",
            "fieldType": "String"
        }
    ],
    "changelogDate": "20170222101924",
    "javadoc": "todo",
    "entityTableName": "food_plan_period",
    "dto": "no",
    "pagination": "pagination",
    "service": "serviceClass"
}

Recipe.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "name",
            "fieldType": "String",
            "fieldValidateRules": [
                "required",
                "minlength",
                "maxlength"
            ],
            "fieldValidateRulesMinlength": 2,
            "fieldValidateRulesMaxlength": 50
        },
        {
            "fieldName": "category",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldName": "description",
            "fieldType": "String"
        },
        {
            "fieldName": "cookingTime",
            "fieldType": "String"
        },
        {
            "fieldName": "servings",
            "fieldType": "String"
        },
        {
            "fieldName": "otherInformation",
            "fieldType": "String"
        }
    ],
    "changelogDate": "20170222101924",
    "entityTableName": "recipe",
    "dto": "no",
    "pagination": "infinite-scroll",
    "service": "serviceClass"
}

Statistics.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [],
    "changelogDate": "20170222101924",
    "entityTableName": "statistics",
    "dto": "no",
    "pagination": "pagination",
    "service": "serviceClass"
}
Browsers and Operating System

java version “1.8.0” Java™ SE Runtime Environment (build 1.8.0-b132) Java HotSpot™ 64-Bit Server VM (build 25.0-b70, mixed mode)

git version 2.11.0 (Apple Git-81)

node: v7.4.0

npm: 4.1.1

bower: 1.8.0

gulp: [21:42:13] CLI version 1.2.2

yeoman: 1.8.5

yarn: 0.19.1

Docker version 17.03.1-ce, build c6d412e

docker-compose version 1.11.2, build dfed245

Entity configuration(s) entityName.json files generated in the .jhipster directory

N/A

Browsers and Operating System

Mac

  • [x ] Checking this box is mandatory (this is just to show you read everything)
Output from upgrade
➜  ~/dev/projects/recipe4 (master ✔) git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
➜  ~/dev/projects/recipe4 (master ✔) yo jhipster:upgrade --verbose
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...
yarn info v0.19.1
4.3.0
Done in 0.25s.
New generator-jhipster version found: 4.3.0
Git repository detected
Updating generator-jhipster to 4.3.0 . This might take some time...
yarn add v0.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@angular/compiler-cli@4.0.0-rc.5" has incorrect peer dependency "@angular/compiler@4.0.0-rc.5".
warning "@angular/compiler-cli@4.0.0-rc.5" has incorrect peer dependency "@angular/core@4.0.0-rc.5".
[4/4] Building fresh packages...
success Saved 3 new dependencies.
├─ generator-jhipster@4.3.0
├─ jhipster-core@1.2.9
└─ js-yaml@3.8.3
$ node node_modules/pngquant-bin/lib/install.js && node node_modules/phantomjs-prebuilt/install.js && yarn run webpack:build
  ✔ pngquant pre-build test passed successfully
Found PhantomJS at /Users/lh/dev/projects/recipe4/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs ...verifying
PhantomJS is previously installed at /Users/lh/dev/projects/recipe4/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
yarn run v0.19.1
$ webpack --config webpack/webpack.vendor.js && webpack --config webpack/webpack.dev.js
(node:10023) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
Hash: d63d85823de90333f971
Version: webpack 2.2.1
Time: 5396ms
                                 Asset     Size  Chunks                    Chunk Names
  674f50d287a8c48dc19ba404d20fe713.eot   166 kB          [emitted]
  677433a0892aaed7b7d2628c313c9775.svg  6 bytes          [emitted]
  b06871f281fee6b241d60582ae9369b9.ttf   166 kB          [emitted]
af7ae505a9eed503f8b8e6982036873e.woff2  77.2 kB          [emitted]
 fee66e712a8a08eef5805a46892932ad.woff    98 kB          [emitted]
                         vendor.dll.js  4.97 MB       0  [emitted]  [big]  vendor
   [0] ./~/@angular/core/index.js 2.54 kB {0} [built]
  [13] ./~/@angular/common/index.js 771 bytes {0} [built]
 [102] ./~/@angular/http/index.js 734 bytes {0} [built]
 [103] ./~/@angular/platform-browser/index.js 635 bytes {0} [built]
 [249] ./~/rxjs/Rx.js 9.58 kB {0} [built]
 [440] ./~/@angular/platform-browser-dynamic/index.js 395 bytes {0} [built]
 [441] ./~/@angular/router/index.js 909 bytes {0} [built]
 [442] ./~/@ng-bootstrap/ng-bootstrap/index.js 4.55 kB {0} [built]
 [443] ./~/angular2-cookie/core.js 782 bytes {0} [built]
 [444] ./~/angular2-infinite-scroll/angular2-infinite-scroll.js 3.19 kB {0} [built]
 [445] ./~/jquery/dist/jquery.js 267 kB {0} [built]
 [446] ./~/ng-jhipster/index.js 2.66 kB {0} [built]
 [447] ./~/ng2-webstorage/dist/app.js 2.99 kB {0} [built]
 [448] ./src/main/webapp/app/vendor.ts 170 bytes {0} [built]
 [869] dll vendor 12 bytes {0} [built]
    + 855 hidden modules
[20:56:35] [write-file-webpack-plugin] options { exitOnErrors: true,
  force: false,
  log: true,
  test: null,
  useHashIndex: true }

[at-loader] Using typescript@2.2.1 from typescript and "tsconfig.json" from /Users/lh/dev/projects/recipe4/tsconfig.json.

(node:10024) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.

[at-loader] Checking started in a separate process...

[at-loader] Ok, 1.13 sec.
[20:56:55] [write-file-webpack-plugin] compiler.outputFileSystem is "NodeOutputFileSystem".
Hash: 77f2b900b9b86c399dea
Version: webpack 2.2.1
Time: 20144ms
                                               Asset       Size  Chunks                    Chunk Names
                            swagger-ui/dist/o2c.html  479 bytes          [emitted]
                ca854e6d0785ba4b9d715049c0bdbcb3.png     9.5 kB          [emitted]
                a30deb26b4eb1521433021e326cbcc2c.png    4.46 kB          [emitted]
                                      main.bundle.js     1.5 MB    0, 3  [emitted]  [big]  main
                                 polyfills.bundle.js     450 kB    1, 3  [emitted]  [big]  polyfills
                                    global.bundle.js    20.5 kB    2, 3  [emitted]         global
                                  manifest.bundle.js    13.6 kB       3  [emitted]         manifest
                       swagger-ui/dist/css/reset.css  773 bytes          [emitted]
                  swagger-ui/dist/css/typography.css    0 bytes          [emitted]
                       swagger-ui/dist/css/print.css    41.7 kB          [emitted]
                      swagger-ui/dist/css/screen.css    43.6 kB          [emitted]
                       swagger-ui/dist/css/style.css    3.49 kB          [emitted]
            swagger-ui/dist/fonts/DroidSans-Bold.ttf    42.5 kB          [emitted]
                 swagger-ui/dist/fonts/DroidSans.ttf      41 kB          [emitted]
                 swagger-ui/dist/images/collapse.gif   69 bytes          [emitted]
                   swagger-ui/dist/images/expand.gif   73 bytes          [emitted]
           swagger-ui/dist/images/explorer_icons.png    5.12 kB          [emitted]
            swagger-ui/dist/images/favicon-32x32.png    1.14 kB          [emitted]
            swagger-ui/dist/images/favicon-16x16.png  445 bytes          [emitted]
                  swagger-ui/dist/images/favicon.ico    5.43 kB          [emitted]
               swagger-ui/dist/images/logo_small.png  455 bytes          [emitted]
              swagger-ui/dist/images/wordnik_api.png  670 bytes          [emitted]
                 swagger-ui/dist/images/throbber.gif    9.26 kB          [emitted]
            swagger-ui/dist/images/pet_store_api.png  631 bytes          [emitted]
                          swagger-ui/dist/lang/ca.js     2.4 kB          [emitted]
                          swagger-ui/dist/index.html    4.33 kB          [emitted]
                          swagger-ui/dist/lang/el.js    3.47 kB          [emitted]
                          swagger-ui/dist/lang/en.js    2.34 kB          [emitted]
                          swagger-ui/dist/lang/es.js    2.46 kB          [emitted]
                          swagger-ui/dist/lang/fr.js     2.5 kB          [emitted]
                         swagger-ui/dist/lang/geo.js    3.86 kB          [emitted]
                       swagger-ui/dist/lang/ko-kr.js    2.32 kB          [emitted]
                          swagger-ui/dist/lang/ja.js    2.72 kB          [emitted]
                          swagger-ui/dist/lang/it.js    2.43 kB          [emitted]
                          swagger-ui/dist/lang/pt.js    2.31 kB          [emitted]
                          swagger-ui/dist/lang/pl.js     2.3 kB          [emitted]
                          swagger-ui/dist/lang/ru.js     3.1 kB          [emitted]
                  swagger-ui/dist/lang/translator.js    1.42 kB          [emitted]
                          swagger-ui/dist/lang/tr.js    2.29 kB          [emitted]
                       swagger-ui/dist/lang/zh-cn.js     2.2 kB          [emitted]
                 swagger-ui/dist/lib/backbone-min.js    19.4 kB          [emitted]
                     swagger-ui/dist/lib/es5-shim.js    22.7 kB          [emitted]
swagger-ui/dist/lib/highlight.9.1.0.pack_extended.js  310 bytes          [emitted]
             swagger-ui/dist/lib/handlebars-4.0.5.js    71.5 kB          [emitted]
            swagger-ui/dist/lib/jquery.ba-bbq.min.js    3.52 kB          [emitted]
         swagger-ui/dist/lib/highlight.9.1.0.pack.js      11 kB          [emitted]
             swagger-ui/dist/lib/jquery-1.8.0.min.js      92 kB          [emitted]
           swagger-ui/dist/lib/jquery.slideto.min.js  365 bytes          [emitted]
            swagger-ui/dist/lib/jquery.wiggle.min.js  536 bytes          [emitted]
                  swagger-ui/dist/lib/js-yaml.min.js    43.5 kB          [emitted]
               swagger-ui/dist/lib/jsoneditor.min.js     130 kB          [emitted]
      swagger-ui/dist/lib/object-assign-pollyfill.js  349 bytes          [emitted]
                   swagger-ui/dist/lib/lodash.min.js    51.9 kB          [emitted]
                       swagger-ui/dist/lib/marked.js    15.7 kB          [emitted]
                swagger-ui/dist/lib/swagger-oauth.js    7.04 kB          [emitted]
                1cd3a1d782e85ba37677c1a2099bc002.png    18.9 kB          [emitted]
            swagger-ui/dist/lib/sanitize-html.min.js     130 kB          [emitted]
                   swagger-ui/dist/swagger-ui.min.js     453 kB          [emitted]  [big]
                       swagger-ui/dist/swagger-ui.js     2.7 MB          [emitted]  [big]
                      swagger-ui/images/throbber.gif    9.26 kB          [emitted]
                               swagger-ui/index.html     7.6 kB          [emitted]
                                         favicon.ico     159 kB          [emitted]
                                          robots.txt  239 bytes          [emitted]
                               i18n/en/activate.json  299 bytes          [emitted]
                                 i18n/en/audits.json  645 bytes          [emitted]
                                   i18n/en/days.json  202 bytes          [emitted]
                          i18n/en/configuration.json  207 bytes          [emitted]
                               i18n/en/foodPlan.json    1.23 kB          [emitted]
                                  i18n/en/error.json  117 bytes          [emitted]
                         i18n/en/foodPlanPeriod.json    1.12 kB          [emitted]
                                i18n/en/gateway.json  345 bytes          [emitted]
                                   i18n/en/home.json  663 bytes          [emitted]
                                 i18n/en/global.json    5.79 kB          [emitted]
                                  i18n/en/login.json  518 bytes          [emitted]
                                 i18n/en/health.json  640 bytes          [emitted]
                                   i18n/en/logs.json  218 bytes          [emitted]
                                i18n/en/metrics.json    3.43 kB          [emitted]
                               i18n/en/password.json  333 bytes          [emitted]
                                 i18n/en/recipe.json    1.58 kB          [emitted]
                               i18n/en/register.json    1.02 kB          [emitted]
                                  i18n/en/reset.json  999 bytes          [emitted]
                               i18n/en/sessions.json  458 bytes          [emitted]
                               i18n/en/settings.json    1.39 kB          [emitted]
                             i18n/en/statistics.json  753 bytes          [emitted]
                                 i18n/en/social.json  594 bytes          [emitted]
                               i18n/sv/activate.json  309 bytes          [emitted]
                        i18n/en/user-management.json  988 bytes          [emitted]
                                 i18n/sv/audits.json  662 bytes          [emitted]
                          i18n/sv/configuration.json  208 bytes          [emitted]
                                   i18n/sv/days.json  198 bytes          [emitted]
                                  i18n/sv/error.json  121 bytes          [emitted]
                               i18n/sv/foodPlan.json    1.22 kB          [emitted]
                         i18n/sv/foodPlanPeriod.json    1.13 kB          [emitted]
                                i18n/sv/gateway.json  345 bytes          [emitted]
                                 i18n/sv/global.json    5.83 kB          [emitted]
                                 i18n/sv/health.json  647 bytes          [emitted]
                                   i18n/sv/home.json  661 bytes          [emitted]
                                   i18n/sv/logs.json  226 bytes          [emitted]
                                  i18n/sv/login.json  548 bytes          [emitted]
                                i18n/sv/metrics.json    3.05 kB          [emitted]
                               i18n/sv/register.json    1.07 kB          [emitted]
                                 i18n/sv/recipe.json     1.6 kB          [emitted]
                               i18n/sv/password.json  325 bytes          [emitted]
                                  i18n/sv/reset.json    1.08 kB          [emitted]
                               i18n/sv/sessions.json  442 bytes          [emitted]
                               i18n/sv/settings.json    1.37 kB          [emitted]
                                 i18n/sv/social.json  594 bytes          [emitted]
                             i18n/sv/statistics.json  747 bytes          [emitted]
                        i18n/sv/user-management.json    1.03 kB          [emitted]
                                       vendor.dll.js    4.97 MB          [emitted]  [big]
                                          index.html  911 bytes          [emitted]
  [12] delegated ./node_modules/@angular/platform-browser/index.js from dll-reference vendor 42 bytes {0} [not cacheable] [built]
  [14] delegated ./node_modules/webpack/buildin/global.js from dll-reference vendor 42 bytes {1} [not cacheable] [built]
  [15] delegated ./node_modules/ng2-webstorage/dist/app.js from dll-reference vendor 42 bytes {0} [not cacheable] [built]
  [16] delegated ./node_modules/process/browser.js from dll-reference vendor 42 bytes {1} [not cacheable] [built]
  [18] delegated ./node_modules/@angular/platform-browser-dynamic/index.js from dll-reference vendor 42 bytes {0} [not cacheable] [built]
  [19] delegated ./node_modules/style-loader/addStyles.js from dll-reference vendor 42 bytes {2} [not cacheable] [built]
[./src/main/webapp/app/app.module.ts] ./src/main/webapp/app/app.module.ts 2.79 kB {0} [built]
  [23] delegated ./src/main/webapp/app/vendor.ts from dll-reference vendor 42 bytes {0} [not cacheable] [built]
[./node_modules/css-loader/index.js!./src/main/webapp/content/css/global.css] ./~/css-loader!./src/main/webapp/content/css/global.css 6.22 kB {2} [built]
[./node_modules/reflect-metadata/Reflect.ts] ./~/reflect-metadata/Reflect.ts 47.3 kB {1} [built]
[./node_modules/zone.js/dist/zone.js] ./~/zone.js/dist/zone.js 102 kB {1} [built]
[./src/main/webapp/app/app.main.ts] ./src/main/webapp/app/app.main.ts 449 bytes {0} [built]
[./src/main/webapp/app/blocks/config/prod.config.ts] ./src/main/webapp/app/blocks/config/prod.config.ts 391 bytes {0} [built]
[./src/main/webapp/app/polyfills.ts] ./src/main/webapp/app/polyfills.ts 170 bytes {1} [built]
[./src/main/webapp/content/css/global.css] ./src/main/webapp/content/css/global.css 950 bytes {2} [built]
    + 260 hidden modules
Child html-webpack-plugin for "index.html":
    [./node_modules/html-webpack-plugin/lib/loader.js!./src/main/webapp/index.html] ./~/html-webpack-plugin/lib/loader.js!./src/main/webapp/index.html 644 bytes {0} [built]
Done in 27.50s.
Done in 35.30s.
Updated generator-jhipster to version 4.3.0
Error jhipster:upgrade --verbose

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

➜  ~/dev/projects/recipe4 (master ✗) git status
On branch master
Your branch is up-to-date with 'origin/master'.
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:   package.json

no changes added to commit (use "git add" and/or "git commit -a")

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
poolebucommented, May 26, 2017

Had to do both yarn upgrade and @jmlw solution (commit the file and run jhipster upgrade again). After that it worked perfectly, thank you! and thank you for this amazing framework

1reaction
jmlwcommented, May 26, 2017

I was able to resolve by committing the changed file, and re-running the upgrade generator

Read more comments on GitHub >

github_iconTop Results From Across the Web

change package-lock.json package back to original repo version
I'm now having issues getting this version back to it's original, which was requested by the repo owners. The major issue I am...
Read more >
Automatically running npm install when switching branches
Here's a wild idea for our prompts: when switching branches, wouldn't it be nice if your prompt showed that the package.json has changed?...
Read more >
Frequently Asked Questions - semantic-release
The package.json 's version will be updated by the semantic-release command just before publishing to npm ...
Read more >
Automatically Install NPM Dependencies on Git Pull
json (lock file) has been changed. If so, I have to run npm install to make sure my dependencies are up to date...
Read more >
Configuration Options - Renovate Docs
Configuration Options usable in renovate.json or package.json. ... Renovate uses branch names as part of its checks to see if an update PR...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found