yii2-apidoc icon indicating copy to clipboard operation
yii2-apidoc copied to clipboard

Not installable using composer anymore?

Open ondics opened this issue 2 years ago • 14 comments
trafficstars

What steps will reproduce the problem?

In my Docker container (php:8.2-bullseye) I use yii2-app-basic:

git clone https://github.com/yiisoft/yii2-app-basic

Then add https://github.com/yiisoft/yii2-app-basic to require section:

"minimum-stability": "stable",
"require": {
    "php": ">=7.4.0",
    "yiisoft/yii2": "~2.0.45",
    "yiisoft/yii2-bootstrap5": "~2.0.2",
    "yiisoft/yii2-symfonymailer": "~2.0.3",
    "yiisoft/yii2-apidoc": "~2.1.0"
},
[...]

Then start composer to resolve dependencies:

$ composer update

What's expected?

This should work now:

$ ./yii help api 

What do you get instead?

root@cc81f319ee70:/app/yii2-app-basic# composer update

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - yiisoft/yii2-apidoc[2.1.0, ..., 2.1.6] require yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.0, ..., 2.0.11].
    - yiisoft/yii2-bootstrap[2.0.9, ..., 2.0.11] require bower-asset/bootstrap 3.4.* | 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.1.0, ..., v3.4.1].
    - yiisoft/yii2-bootstrap[2.0.1, ..., 2.0.8] require bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.1.0, ..., v3.3.7].
    - yiisoft/yii2-bootstrap 2.0.0 requires bower-asset/bootstrap 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.1.0, v3.1.1, v3.2.0].
    - You can only install one version of a package, so only one of these can be installed: bower-asset/bootstrap[v3.1.0, ..., v3.4.1, v5.1.0, ..., v5.3.0].
    - yiisoft/yii2-bootstrap5[2.0.2, ..., 2.0.4] require bower-asset/bootstrap ^5.1.0 -> satisfiable by bower-asset/bootstrap[v5.1.0, ..., v5.3.0].
    - Root composer.json requires yiisoft/yii2-bootstrap5 ~2.0.2 -> satisfiable by yiisoft/yii2-bootstrap5[2.0.2, 2.0.3, 2.0.4].
    - Root composer.json requires yiisoft/yii2-apidoc ~2.1.0 -> satisfiable by yiisoft/yii2-apidoc[2.1.0, ..., 2.1.6].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Is there something missing in the installations section of yii2-apidoc ?

ondics avatar Jul 24 '23 09:07 ondics

What happens if you remove Bootstrap5 extension from composer.json?

mtangoo avatar Jul 27 '23 14:07 mtangoo

Without Bootstrap5 this is the new composer.json require: section:

"require": {
    "php": ">=7.4.0",
    "yiisoft/yii2": "~2.0.45",
    "yiisoft/yii2-symfonymailer": "~2.0.3",
    "yiisoft/yii2-apidoc": "~2.1.0"
},

But these errors remain:

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yiisoft/yii2-symfonymailer ~2.0.3 -> satisfiable by yiisoft/yii2-symfonymailer[2.0.3, 2.0.4].
    - yiisoft/yii2-apidoc[2.1.0, ..., 2.1.6] require phpdocumentor/reflection-docblock ^2.0.4 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4, 2.0.5].
    - Conclusion: don't install phpdocumentor/reflection-docblock 2.0.5 (conflict analysis result)
    - Root composer.json requires yiisoft/yii2-apidoc ~2.1.0 -> satisfiable by yiisoft/yii2-apidoc[2.1.0, ..., 2.1.6].

ondics avatar Jul 31 '23 10:07 ondics

If I remove the require-dev section and the symfonymailer to

"require": {
    "php": ">=7.4.0",
    "yiisoft/yii2": "~2.0.45",
    "yiisoft/yii2-apidoc": "~2.1.0"
},

then it works. But I need the yii2-symfonymailer!

ondics avatar Jul 31 '23 10:07 ondics

Next error: ./yii help api results in:

# ./yii help api
Exception 'yii\di\NotInstantiableException' with message 'Failed to instantiate component or class "yii\gii\Module".'

in /app/yii2-app-basic/vendor/yiisoft/yii2/di/Container.php:509
Caused by: Exception 'ReflectionException' with message 'Class "yii\gii\Module" does not exist'
in /app/yii2-app-basic/vendor/yiisoft/yii2/di/Container.php:507

Stack trace:
#0 /app/yii2-app-basic/vendor/yiisoft/yii2/di/Container.php(507): ReflectionClass->__construct('yii\\gii\\Module')
#1 /app/yii2-app-basic/vendor/yiisoft/yii2/di/Container.php(385): yii\di\Container->getDependencies('yii\\gii\\Module')
#2 /app/yii2-app-basic/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('yii\\gii\\Module', Array, Array)
#3 /app/yii2-app-basic/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('yii\\gii\\Module', Array, Array)
#4 /app/yii2-app-basic/vendor/yiisoft/yii2/base/Module.php(445): yii\BaseYii::createObject(Array, Array)
#5 /app/yii2-app-basic/vendor/yiisoft/yii2/base/Application.php(313): yii\base\Module->getModule('gii')
#6 /app/yii2-app-basic/vendor/yiisoft/yii2/base/Application.php(271): yii\base\Application->bootstrap()
#7 /app/yii2-app-basic/vendor/yiisoft/yii2/console/Application.php(124): yii\base\Application->init()
#8 /app/yii2-app-basic/vendor/yiisoft/yii2/base/BaseObject.php(109): yii\console\Application->init()
#9 /app/yii2-app-basic/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct(Array)
#10 /app/yii2-app-basic/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#11 /app/yii2-app-basic/yii(19): yii\console\Application->__construct(Array)
#12 {main}

ondics avatar Jul 31 '23 10:07 ondics

then it works. But I need the yii2-symfonymailer!

What happens if you change version of mailer from ~2.0.3 to ~3.0.0?

mtangoo avatar Jul 31 '23 17:07 mtangoo

Exception 'yii\di\NotInstantiableException' with message 'Failed to instantiate component or class "yii\gii\Module".'

Can you check if Gii module is defined in the console config?

mtangoo avatar Jul 31 '23 17:07 mtangoo

then it works. But I need the yii2-symfonymailer!

What happens if you change version of mailer from ~2.0.3 to ~3.0.0?

/app/yii2-app-basic# composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yiisoft/yii2-symfonymailer ~3.0.0 -> satisfiable by yiisoft/yii2-symfonymailer[3.0.0].
    - yiisoft/yii2-apidoc[2.1.0, ..., 2.1.6] require phpdocumentor/reflection-docblock ^2.0.4 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4, 2.0.5].
    - Conclusion: don't install phpdocumentor/reflection-docblock 2.0.5 (conflict analysis result)
    - Root composer.json requires yiisoft/yii2-apidoc ~2.1.0 -> satisfiable by yiisoft/yii2-apidoc[2.1.0, ..., 2.1.6].

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

ondics avatar Jul 31 '23 18:07 ondics

Exception 'yii\di\NotInstantiableException' with message 'Failed to instantiate component or class "yii\gii\Module".'

Can you check if Gii module is defined in the console config?

I'm using https://github.com/yiisoft/yii2-app-basic out of the box - Nothing modified in configs.

Do I have to modify config settings?

ondics avatar Jul 31 '23 18:07 ondics

I'm using https://github.com/yiisoft/yii2-app-basic out of the box - Nothing modified in configs.

I thought this was problem only in docker which is not set in my machine. I will install it from Basic and check it out. Sorry for what you are facing. It should just work

mtangoo avatar Aug 01 '23 15:08 mtangoo

Hi, Please remove vendor directory and composer.lock Change apidoc version to 3.0.6 i.e. "yiisoft/yii2-apidoc": "~3.0.6" Run composer install

when completed then run ./vendor/bin/apidoc help

Then let me know if you get everything successful!

mtangoo avatar Aug 03 '23 06:08 mtangoo

Thx, seems to work.

I didn't know that I've to run ./vendor/bin/apidoc help.

I assumed apidoc can be called using ./yii command line executor. Maybe this should be clarified in the README.md

ondics avatar Aug 03 '23 07:08 ondics

I didn't know that I've to run ./vendor/bin/apidoc help.

apidoc installs a command-line tool for doing the tasks

mtangoo avatar Aug 03 '23 07:08 mtangoo

I will leave this open until doc is updated

mtangoo avatar Aug 03 '23 08:08 mtangoo

The issue comes with bootstrap5. Removed it from the requires section, apidoc can be installed.

This package has the dependency to yiisoft/yii2-bootstrap but if anyone need to install bootstrap5, then won't be able to install due to yii2-apidoc dependency.

neoacevedo avatar Sep 27 '23 17:09 neoacevedo