makeze
makeze

Reputation: 65

Composer clones from cache instead of repo

I have two projects I am working on, both were setup as git repos, both use composer. First project uses second as a library. I configured composer.json in the following way:

... "repositories": [
    {"type": "composer", "url":"http://composer.myrepourl.com/repo/private/"},
]

"require": {
    "second/second": "dev-B-3"
} ...

There was no problem pulling the project from a repository for the first time. However now I made some changes in second project, pushed to the repo and now want to have them in first project, but for some reason composer pulls from the cache.

I ran composer clear-cache. I tried deleting: vendor folder, /home/user/.composer/cache, cache inside container /root/.composer/, but it still finds a way to clone the second project from cache instead of pulling it from repo.

Any ideas on how to force composer to always pull from repo instead of cloning from cache?

Upvotes: 7

Views: 11824

Answers (3)

localheinz
localheinz

Reputation: 9582

Run

$ composer install --prefer-source

Alternatively, specify your preferred installation method in composer.json generally:

{
    "config": {
        "preferred-install": "source"
    }
}

or specifically for the desired dependency

generally:

{
    "config": {
        "preferred-install": {
            "vendor/package": "source",
            "*": "dist"
        }
    }
}

For reference, see:

Upvotes: 8

Walterwhites
Walterwhites

Reputation: 1477

you should run

composer clear-cache

then

composer update --prefer-source

Upvotes: 2

makeze
makeze

Reputation: 65

Ok I have found a solution:

sudo rm -r /home/user/project/vendor
cd %wherever_your_docker_is%
docker-compose stop
docker-compose rm
docker-compose up -d
composer update

Upvotes: 0

Related Questions