I'm not able to install backup_migrate with composer. I have minimum-stability set to dev in my composer.json file, and I'm trying to install the 4.0-alpha1 version. I've tried specifying the dev version specifically, and I get the same error.

> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - drupal/backup_migrate 4.0.0-alpha1 requires backupmigrate/core dev-master -> no matching package found.
    - drupal/backup_migrate 4.x-dev requires backupmigrate/core dev-master -> no matching package found.
    - Installation request for drupal/backup_migrate ^4.0 -> satisfiable by drupal/backup_migrate[4.x-dev, 4.0.0-alpha1].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Comments

mlanning created an issue. See original summary.

mlahde’s picture

I got the same error today and was able to solve it by adding the following dependencies:

"backupmigrate/core": "dev-master",
"psr/log": "dev-master",

along with the repo addition (the latter below):

"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "vcs",
"url": "https://github.com/backupmigrate/backup_migrate_core"
}

],

After this I was able to install B&M and enable it nicely in my environment.

mlahde’s picture

Assigned: Unassigned » mlahde
Status: Active » Needs review
mlanning’s picture

Thank you, mlahde. This worked for me as well.

Jax’s picture

Status: Needs review » Needs work

The module should manage its own dependencies. The goal is that a composer require drupal/backup_migrate should work.

albertski’s picture

Also, can you use a released version fo psr/log. I get the following error:

Problem 1
- Can only install one of: psr/log[dev-master, 1.0.2].
- Can only install one of: psr/log[dev-master, 1.0.2].
- Can only install one of: psr/log[dev-master, 1.0.2].
- drupal/backup_migrate 8.4.0-alpha1 requires psr/log dev-master -> satisfiable by psr/log[dev-master].
- Installation request for drupal/backup_migrate 8.4.0-alpha1 -> satisfiable by drupal/backup_migrate[8.4.0-alpha1].
- Installation request for psr/log (locked at 1.0.2) -> satisfiable by psr/log[1.0.2].

A lot of Symphony components require it.

shawngo’s picture

I was having issues configuring the composer.json file so I'm posting what I did to get Backup Migrate downloaded using the information from previous comments.

Update composer.json: This is what my dependencies and repositories looked like after adding dependencies and the second repository. The entire dependencies section was added and the vcs repository was added. Repositories was previously keyed with "drupal" (from composer installation) so I changed it to an array.

    "dependencies": {
        "backupmigrate/core": "dev-master",
        "psr/log": "dev-master"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "vcs",
            "url": "https://github.com/backupmigrate/backup_migrate_core"
        }
    ],

I then added backup_migrate to the require section:

    "require": {
     ...
        "drupal/backup_migrate": "^4.0@alpha"
    }

Once these changes were made I was able to run composer update and it successfully downloaded the module.

I'm not sure if this is the correct way or if I was interpreting comments incorrectly. This is just how I happened to get it installed since the instructions didn't fill all the gaps.

kay_v’s picture

the suggestions from @shawngo were a good lead for me, but I had to change a few things to get past the errors:

{ ...
    "repositories": {
        "0": {
          "type": "vcs",
          "url": "https://github.com/backupmigrate/backup_migrate_core"
        },
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    },
    "require": {
        ...
        "backupmigrate/core": "dev-master",
        "psr/log": "dev-master"
    }
...
}
borisson_’s picture

What should be done to fix these issues as far as I can see is:

- Tag a release for the backupmigrate/backup_migrate_core package (1.0.0?)
- Submit the package (github library) to packagist (https://packagist.org/packages/submit/)
- Change the drupal module's composer.json to use the tagged version.
- Profit!

I don't think any of the non-maintainers can help out here - tagging / submitting the github library is maintainer-only work.

The suggestions in #2, #7 and #8 are workarounds that we shouldn't have to worry about.

borisson_’s picture

Version: 8.x-4.0-alpha1 » 8.x-4.x-dev
Assigned: mlahde » Unassigned
Status: Needs work » Active

Also, as long as there are no patches and nothing to be reviewed by the community this should probably still be 'active'.

borisson_’s picture

Priority: Normal » Major

Elevating priority to get this on the rader of the maintainers as this is something that we as the community can't help out with.

nicxvan’s picture

Generally editing a composer.json file directly is frowned upon. Installing this with the command line worked for me in a three step process.

Add the vcs repository dependency:

composer config repositories.backup_migrate vcs https://github.com/backupmigrate/backup_migrate_core

Note you can call the repository what you want.

Add psr/log dev dependency:
composer require "psr/log":"dev-master"

Add backup migrate
composer require drupal/backup_migrate

This worked for the backup_migrate alpha

dobrzyns’s picture

@nicxvan Those steps worked for me.

HOWEVER, we should be able to simply require `drupal/composer`, and it should work.

borisson_’s picture

The step for requiring psr/log can be removed if https://github.com/backupmigrate/backup_migrate_core/pull/2 gets merged in.

couturier’s picture

Users who are having trouble using Backup and Migrate with Composer may want to consider switching to Backup Database, a stable, maintained module for Drupal 8 that is already dependent upon Composer.

caspervoogt’s picture

It's a shame there is a need for workarounds when "require drupal/backup_migrate" ought to work, and it ought to manage its own dependencies, the way it's meant to using Composer.

couturier’s picture

This is a related issue (closed as duplicate): composer requirements not resolved after composer update

As a warning added to my comment #15 about the alternate Backup Database module already dependent on Composer, some users are saying the currently recommended release doesn't work for them, but the Backup Database dev version does. Backup and Migrate has much more functionality than Backup Database, and maintainer ronan has said he plans to continue working on Backup and Migrate and release another alpha by summer 2017.

A lot of bugs have been fixed with the 8.x-4.0-alpha2 release of Backup and Migrate on April 4, 2017, so I am wondering if these Composer problems have been resolved with the new release. Both this issue and the one linked above (closed as duplicate) were reported prior to the most recent alpha 2 release.

couturier’s picture

An interesting comment was just posted at the issue I closed as a duplicate regarding the role of Composer in Backup and Migrate:

This issue is related to the general discussion about the role of composer for backup_migrate in https://www.drupal.org/node/2607038 and https://www.drupal.org/node/2822885 . Currently the github hosted library is integrated into the codebase (in the vendor folder) and does not utilize composer in a proper way.

ilclaudio’s picture

With Drupal 8.3.1 I used the suggestions of @nicxvan #12 and the installation was successful.
Thank you nicxvan.
Now I have an error during the backup of the entire site, I'm reporting the error in the issues.

ronan’s picture

Status: Active » Fixed

I have cleaned out the composer stuff from the distribution so the module should be installable with composer now. Just be sure to use `composer require drupal/backup_migrate:4.x-dev` until the next alpha is released.

Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.