dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

laravel 6.x ,install dingo/aip 2.3,failure. #1683

Closed eric2100 closed 5 years ago

eric2100 commented 5 years ago
Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 6.0.4
Package version 2.3
PHP version 7
composer require dingo/api
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^2.3 for dingo/api
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
  - Installing league/fractal (0.17.0): Downloading (100%)
  - Installing doctrine/annotations (v1.7.0): Downloading (100%)
  - Installing dingo/blueprint (dev-master 32e611e): Cloning 32e611eb73
  - Installing dingo/api (v2.4.0-rc1): Downloading (100%)
league/fractal suggests installing pagerfanta/pagerfanta (Pagerfanta Paginator)
league/fractal suggests installing zendframework/zend-paginator (Zend Framework Paginator)
dingo/api suggests installing tymon/jwt-auth (Protect your API with JSON Web Tokens.)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Symfony\Component\Debug\Exception\FatalThrowableError  : Argument 1 passed to Dingo\Api\Http\Response::setFormatters() must be of the type array, null given, called in /home/www3/public_html/vendor/dingo/api/src/Provider/DingoServiceProvider.php on line 34

  at /home/www3/public_html/vendor/dingo/api/src/Http/Response.php:257
    253|      * @param array $formatters
    254|      *
    255|      * @return void
    256|      */
  > 257|     public static function setFormatters(array $formatters)
    258|     {
    259|         static::$formatters = $formatters;
    260|     }
    261|

  Exception trace:

  1   Dingo\Api\Http\Response::setFormatters()
      /home/www3/public_html/vendor/dingo/api/src/Provider/DingoServiceProvider.php:34

  2   Dingo\Api\Provider\DingoServiceProvider::setResponseStaticInstances()
      /home/www3/public_html/vendor/dingo/api/src/Provider/DingoServiceProvider.php:23

  Please use the argument -v to see more details.
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.
specialtactics commented 5 years ago

I think you mean v2.4.0-rc1 not 2.3 ? Anyway, I will look into it.

specialtactics commented 5 years ago

@eric2100 I can't reproduce the problem you are describing, but I am just updating, haven't tried to install from scratch. So you previously did not have dingo in your project?.

Can I suggest you try this:

rm -rf vendor
composer clear-cache
composer install
composer require dingo/api
eric2100 commented 5 years ago

@eric2100 I can't reproduce the problem you are describing, but I am just updating, haven't tried to install from scratch. So you previously did not have dingo in your project?.

Can I suggest you try this:

rm -rf vendor
composer clear-cache
composer install
composer require dingo/api

I still follow the instructions in your steps.

I have a package installed

composer require davejamesmiller/laravel-breadcrumbs
composer require barryvdh/laravel-cors
composer require barryvdh/laravel-ide-helper
composer require intervention/image
composer require spatie/laravel-permission
composer require jenssegers/agent
composer require laravelcollective/html
composer require romanzipp/laravel-validator-pizza
composer require torann/geoip
composer require recca0120/laravel-tracy
composer require uepg/laravel-sybase
composer require irazasyed/telegram-bot-sdk 

error message

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
  - Installing league/fractal (0.17.0): Downloading (100%)
  - Installing doctrine/annotations (v1.7.0): Downloading (100%)
  - Installing dingo/blueprint (v0.3.0): Downloading (100%)
  - Installing dingo/api (v2.4.0-rc2): Downloading (100%)
league/fractal suggests installing pagerfanta/pagerfanta (Pagerfanta Paginator)
league/fractal suggests installing zendframework/zend-paginator (Zend Framework Paginator)
dingo/api suggests installing tymon/jwt-auth (Protect your API with JSON Web Tokens.)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Symfony\Component\Debug\Exception\FatalThrowableError  : Argument 1 passed to Dingo\Api\Http\Response::setFormatters() must be of the type array, null given, called in /home/www3/public_html/vendor/dingo/api/src/Provider/DingoServiceProvider.php on line 34

  at /home/www3/public_html/vendor/dingo/api/src/Http/Response.php:257
    253|      * @param array $formatters
    254|      *
    255|      * @return void
    256|      */
  > 257|     public static function setFormatters(array $formatters)
    258|     {
    259|         static::$formatters = $formatters;
    260|     }
    261|

  Exception trace:

  1   Dingo\Api\Http\Response::setFormatters()
      /home/www3/public_html/vendor/dingo/api/src/Provider/DingoServiceProvider.php:34

  2   Dingo\Api\Provider\DingoServiceProvider::setResponseStaticInstances()
      /home/www3/public_html/vendor/dingo/api/src/Provider/DingoServiceProvider.php:23

  Please use the argument -v to see more details.
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.
eric2100 commented 5 years ago

The new installation of laravel 6, the packager is installed normally.

Ravisondagar commented 4 years ago

please solve this error

specialtactics commented 4 years ago

@Ravisondagar If there is an issue, it's inside your composer.json file, not this library