btcpayserver/commerce_btcpay

Installation with composer not possible

Closed this issue · 10 comments

HI,

I tryed to add the module with composer, but got a few problems.

How can I fix this?

composer require 'drupal/commerce_btcpay:1.x-dev@dev'
./composer.json has been updated
Running composer update drupal/commerce_btcpay
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- bitpay/php-client 2.2.x-dev requires ext-mcrypt * -> it is missing from your system. Install or enable PHP's mcrypt extension.
- bitpay/php-client v2.2.20 requires symfony/dependency-injection ^2.3 || ^3.0 -> found symfony/dependency-injection[v2.3.0, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.4.x-dev] but the package is fixed to v4.4.16 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- drupal/commerce_btcpay 1.x-dev is an alias of drupal/commerce_btcpay dev-1.x and thus requires it to be installed too.
- drupal/commerce_btcpay dev-1.x requires bitpay/php-client ^2.2.20 -> satisfiable by bitpay/php-client[v2.2.20, 2.2.x-dev].
- Root composer.json requires drupal/commerce_btcpay 1.x-dev@dev -> satisfiable by drupal/commerce_btcpay[1.x-dev (alias of dev-1.x)].

To enable extensions, verify that they are enabled in your .ini files:
- /etc/php73/cli/php.ini
- /etc/php73/cli/conf.d/01_ioncube.ini
- /etc/php73/cli/conf.d/04propro.ini
- /etc/php73/cli/conf.d/04raphf.ini
- /etc/php73/cli/conf.d/05http.ini
- /etc/php73/cli/conf.d/10mysqlnd.ini
- /etc/php73/cli/conf.d/10pdo.ini
- /etc/php73/cli/conf.d/chroot_memory_limit.ini
- /etc/php73/cli/conf.d/curl.ini
- /etc/php73/cli/conf.d/fileinfo.ini
- /etc/php73/cli/conf.d/gd.ini
- /etc/php73/cli/conf.d/gender.ini
- /etc/php73/cli/conf.d/gmp.ini
- /etc/php73/cli/conf.d/imagick.ini
- /etc/php73/cli/conf.d/imap.ini
- /etc/php73/cli/conf.d/interbase.ini
- /etc/php73/cli/conf.d/intl.ini
- /etc/php73/cli/conf.d/ldap.ini
- /etc/php73/cli/conf.d/mailparse.ini
- /etc/php73/cli/conf.d/mongodb.ini
- /etc/php73/cli/conf.d/mysqli.ini
- /etc/php73/cli/conf.d/oauth.ini
- /etc/php73/cli/conf.d/odbc.ini
- /etc/php73/cli/conf.d/pdo_dblib.ini
- /etc/php73/cli/conf.d/pdo_firebird.ini
- /etc/php73/cli/conf.d/pdo_mysql.ini
- /etc/php73/cli/conf.d/pdo_odbc.ini
- /etc/php73/cli/conf.d/pdo_pgsql.ini
- /etc/php73/cli/conf.d/pdo_sqlite.ini
- /etc/php73/cli/conf.d/pgsql.ini
- /etc/php73/cli/conf.d/phar.ini
- /etc/php73/cli/conf.d/pspell.ini
- /etc/php73/cli/conf.d/recode.ini
- /etc/php73/cli/conf.d/sodium.ini
- /etc/php73/cli/conf.d/sqlite3.ini
- /etc/php73/cli/conf.d/tidy.ini
- /etc/php73/cli/conf.d/xsl.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

ndeet commented

Hi,

can you give more information on which Drupal version, PHP version 7.3? and on which OS you are?

  • bitpay/php-client 2.2.x-dev requires ext-mcrypt * -> it is missing from your system. Install or enable PHP's mcrypt extension.

Like the error says there is some PHP extension missing. Depending on your OS you need to make sure your PHP version supports mcrypt extension.

  • bitpay/php-client v2.2.20 requires symfony/dependency-injection ^2.3 || ^3.0 -> found symfony/dependency-injection[v2.3.0, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.4.x-dev] but the package is fixed to v4.4.16 (lock file version) by a partial

I think this could be caused by Drupal 9 Core locking Symfony v4 and the Bitpay library conflicting with it as it requires v2 or v3. I will take check and test tomorrow.

ndeet commented

@diskbuster

I just tried the install with a fresh D9.1 and commerce demo shop. Works without any problem for me using PHP 7.3. Let me know your details so I can reproduce the problem.

$ composer require drupal/commerce_btcpay

Using version ^1.0@alpha for drupal/commerce_btcpay
./composer.json has been updated

Running composer update drupal/commerce_btcpay
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies
Lock file operations: 3 installs, 0 updates, 0 removals
  - Locking bitpay/php-client (v2.2.20)
  - Locking drupal/commerce_btcpay (1.0.0-alpha4)
  - Locking symfony/config (v3.4.47)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Downloading symfony/config (v3.4.47)
  - Downloading bitpay/php-client (v2.2.20)
  - Downloading drupal/commerce_btcpay (1.0.0-alpha4)
  - Installing symfony/config (v3.4.47): Extracting archive
  - Installing bitpay/php-client (v2.2.20): Extracting archive
  - Installing drupal/commerce_btcpay (1.0.0-alpha4): Extracting archive
Package bitpay/php-client is abandoned, you should avoid using it. Use bitpay/sdk instead.
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
62 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> DrupalProject\composer\ScriptHandler::createRequiredFiles

I've a similar problem with D9.2.5 using lando

$ mkdir commerce-btcpay && \
  cd commerce-btcpay && \
  lando init \
    --source remote \
    --remote-url https://www.drupal.org/download-latest/tar.gz \
    --remote-options="--strip-components 1" \
    --recipe drupal9 \
    --webroot . \
    --name commerce-btcpay 
$ lando start
$ vi composer.json
    "minimum-stability": "alpha",
$ lando composer require drupal/commerce_btcpay

...
Using version ^1.0@alpha for drupal/commerce_btcpay
./composer.json has been updated
Running composer update drupal/commerce_btcpay
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - drupal/commerce_btcpay 1.0.0-alpha4 requires bitpay/php-client ^2.2.20 -> satisfiable by bitpay/php-client[v2.2.20].
    - drupal/commerce_btcpay[1.0.0-alpha1, ..., 1.0.0-alpha3] require drupal/core ~8.0 -> found drupal/core[8.0.0-beta6, ..., 8.9.18] but the package is fixed to 9.2.5 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - bitpay/php-client v2.2.20 requires symfony/dependency-injection ^2.3 || ^3.0 -> found symfony/dependency-injection[v2.3.0, ..., v2.8.52, v3.0.0-BETA1, ..., v3.4.47] but the package is fixed to v4.4.25 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires drupal/commerce_btcpay ^1.0@alpha -> satisfiable by drupal/commerce_btcpay[1.0.0-alpha1, 1.0.0-alpha2, 1.0.0-alpha3, 1.0.0-alpha4].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I believe this is PHP 7.3

ndeet commented

Hi, thanks for the detailed problem report. Seems that the bitpay php client required symfony/dependency-injection 2 or 3 but latest Drupal Core uses v4, which is a problem. Will have time to debug this more later today or tomorrow morning.

Hi, thanks for the detailed problem report. Seems that the bitpay php client required symfony/dependency-injection 2 or 3 but latest Drupal Core uses v4, which is a problem. Will have time to debug this more later today or tomorrow morning.

Hey @ndeet thanks for the response. I'm thinking that it probably isn't worth pursuing the old bitpay client. It seems like we should make a decision about supporting bitpay, or not, and then cut over to newer, supported libraries. I see you're working on all of them (!?!). Perhaps the greenfield one?

ndeet commented

Hi @queenvictoria I tried another lib but did not work out. The official lib is abandoned but master branch was actually compatible until someone hardcoded symfony/dependency-injection to 4.1.12 which is incompatible to 4.4.x used by D9.2. So I forked the repo, restored the working version constraints and added it as composer package.

tldr; you can now try if alpha5 works for you, had no time to test atm but will do later

For greenfield api, yes it will be coming and we are building out the PHP library at the moment but some refactoring needed for this module, so it is on the todo but will take one or two months until I have time to do it for Drupal.

Hey @ndeet thanks for your effort!

That sounds like a great solution for the interrim between these two states. I'll try that out.

Just out of interest--greenfield: will it still support Bitpay? That's not my usecase: I am just wondering.

ndeet commented

Hi @queenvictoria,

regarding greenfield, it is incompatible with BitPay as it is tailored for BTCPay Server and allows much more than the old library. E.g. you can manage the store configuration (on BTCPay Server), your Lightning Node, add wallets etc.

Just for background information. BTCPay Server (self hosted, open source) was started to make BitPay (closed source and "enemy" of Bitcoin because they pushed for Bitcoin Cash) obsolete. So while it was good at the beginning to maintain 1:1 compatibility with BitPay it would hold back the possibilities going forward, that's why greenfield api was introduced.

Perfect explanation thanks @ndeet

Ok! Just documenting it here (I'll come back and tidy up I promise) the recipe to get alpha5 installed with lando (I'm fairly new to composer and lando and the Drupal 8/9 pattern).

Note:

  • minimum stability dev
  • composer version number pattern (1.0.0-alpha5 not any old Drupal pattern)
"repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "url": "https://github.com/btcpayserver/commerce_btcpay.git",
            "type": "git"
        }
    ],
    "require": {
        "composer/installers": "^1.9",
        "drupal/core-composer-scaffold": "^9.2",
        "drupal/core-project-message": "^9.2",
        "drupal/core-recommended": "^9.2",
        "drupal/core-vendor-hardening": "^9.2",
        "drupal/commerce_btcpay": "1.0.0-alpha5"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",

And then $ lando composer update