PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, May 20, 2022

[FIXED] Why Composer isn't updating a package to patch version?

 May 20, 2022     composer-php     No comments   

Issue

I have the following line in the composer.json require section.

"johnpbloch/wordpress-core": "^5.8"

Running composer outdated tells me, that there's an 5.8.1 update available. To my understanding the version constraint shouldn't block this version and updating to it should be possible.

For some reason running composer update johnpbloch/wordpress-core does nothing. The installed version stays at 5.8. composer require johnpbloch/wordpress-core doesn't update the package to the latest version either. Composer just keeps telling me that there's nothing to update. And I don't understand why.

I did try giving the update command the version directly, composer update johnpbloch/wordpress-core:5.8.1, which gave me the following error.

johnpbloch/wordpress 5.8.0 requires johnpbloch/wordpress-core 5.8.0 -> found johnpbloch/wordpress-core[5.8.0] 
but it conflicts with your root composer.json require (^5.8, 5.8.1)

I have a feeling that I'm missing something obvious here, but can't see what. Hopefully someone could shed light on what could be causing this.

Here's the stripped down composer.json file I'm using. I left out the name and description as I don't want to share them here.

{
    "type": "project",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "composer",
            "url": "https://wpackagist.org"
        }
    ],
    "require": {
        "wecodemore/wpstarter": "~2.0",
        "johnpbloch/wordpress-core": "^5.8",
        "wpackagist-plugin/wordpress-seo": "^17.3",
        "inpsyde/wp-translation-downloader": "^2.0"
    },
    "config": {
        "vendor-dir": "public_html/content/vendor",
        "optimize-autoloader": true
    },
    "scripts": {
        "post-install-cmd": "WCM\\WPStarter\\Setup::run",
        "post-update-cmd": "WCM\\WPStarter\\Setup::run",
        "wpstarter": "WCM\\WPStarter\\Setup::run"
    },
    "extra": {
        "wordpress-install-dir": "public_html/wp",
        "wordpress-content-dir": "public_html/content",
        "wpstarter": {
            "prevent-overwrite": [
                ".gitignore",
                ".htaccess",
                "wp-config.php",
                "index.php"
            ],
            "env-example": "public_html/content/vendor/wecodemore/wpstarter/wpstarter/templates/.env.example",
            "gitignore": {
                "wp": true,
                "wp-content": true,
                "vendor": true,
                "common": true,
                "custom": [
                    "*.log",
                    ".htaccess",
                    "sitemap.xml",
                    "sitemap.xml.gz"
                ]
            }
        },
        "installer-paths": {
            "public_html/content/plugins/{$name}": [
                "type:wordpress-plugin"
            ],
            "public_html/content/mu-plugins/{$name}": [
                "type:wordpress-muplugin"
            ],
            "public_html/content/themes/{$name}": [
                "type:wordpress-theme"
            ]
        },
        "wp-translation-downloader": {
            "languages": [
                "fi",
                "sv_SE"
            ],
            "directory": "public_html/content/languages"
        }
    }
}

Solution

you ran: composer update johnpbloch/wordpress-core:5.8.1 this results in error johnpbloch/wordpress 5.8.0 requires johnpbloch/wordpress-core 5.8.0

so the answer is simple: jp/wordpress-core:5.8.1 conflicts with jp/wordpress:5.8.0 which requires explicit jp/wordpress-core:5.8.0 (not allowing any patch version updates).

To solve: run composer update johnpbloch/wordpress-core johnpbloch/wordpress it will whitelist both packages for updates and resolves the newest version possible



Answered By - Norman M
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing