The command "composer require barryvdh/laravel-dompdf" always gets an error - php

I am trying to run this command: composer require barryvdh/laravel-dompdf
And I get this in my cmd:
Using version ^1.0 for barryvdh/laravel-dompdf
./composer.json has been updated
Running composer update barryvdh/laravel-dompdf
Loading composer repositories with package information
Updating dependencies
Lock file operations: 5 installs, 0 updates, 0 removals
- Locking barryvdh/laravel-dompdf (v1.0.0)
- Locking dompdf/dompdf (v1.2.2)
- Locking phenx/php-font-lib (0.5.4)
- Locking phenx/php-svg-lib (0.4.1)
- Locking sabberworm/php-css-parser (8.4.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 5 installs, 0 updates, 0 removals
- Installing sabberworm/php-css-parser (8.4.0): Extracting archive
- Installing phenx/php-svg-lib (0.4.1): Extracting archive
- Installing phenx/php-font-lib (0.5.4): Extracting archive
- Installing dompdf/dompdf (v1.2.2): Extracting archive
- Installing barryvdh/laravel-dompdf (v1.0.0): Extracting archive
3 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
#php artisan package:discover --ansi
In PackageManifest.php line 178:
The C:\xampp\htdocs\Proyectos\Monitor\bootstrap\cache directory must be present and writable.
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
And even on top of that, my project stopped working and shows:
This error that I've never seen before
I tried everything that I found on internet, clear cache, update composer and still I get the same kind of error, I am using Laravel 9 version. I'm desperate please help

Step 1 : Delete the cache folder and recreate again in bootstrap directory.
step 2 : run the command php artisan cache:clear

Related

Call to undefined method Laravel\Socialite\Facades\Socialite::isDeferred()

Hi i'm new to laravel socialite,when i run the command php artisan config:cache to update the .env file i get this error: Call to undefined method Laravel\Socialite\Facades\Socialite::isDeferred();
composer require laravel/socialite
Using version ^5.1 for laravel/socialite
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
Installing ralouphie/getallheaders (3.0.3): Loading from cache
Installing guzzlehttp/psr7 (1.7.0): Loading from cache
Installing guzzlehttp/promises (1.4.0): Loading from cache
Installing guzzlehttp/guzzle (7.2.0): Loading from cache
Installing league/oauth1-client (v1.8.2): Loading from cache
Installing laravel/socialite (v5.1.0): Loading from cache
'C:\xampp\htdocs\matatu6.0\vendor/laravel/socialite/59c666443f49cf231e2c48e7a17aefd5' is not a zip archive.
Unzip with ZipArchive class failed, falling back to unzip command
Failed to download laravel/socialite from dist: Failed to execute (9) unzip -qq -o "C:\xampp\htdocs\matatu6.0\vendor/laravel/socialite/59c666443f49cf231e2c48e7a17aefd5" -d "C:\x
ampp\htdocs\matatu6.0/vendor/composer/5556bc2b"
[C:\xampp\htdocs\matatu6.0\vendor/laravel/socialite/59c666443f49cf231e2c48e7a17aefd5]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of C:\xampp\htdocs\matatu6.0\vendor/laravel/socialite/59c666443f49cf231e2c48e7a17aefd5 or
C:\xampp\htdocs\matatu6.0\vendor/laravel/socialite/59c666443f49cf231e2c48e7a17aefd5.zip, and cannot find C:\xampp\htdocs\matatu6.0\vendor/laravel/socialite/59c666443f49cf231
e2c48e7a17aefd5.ZIP, period.
Now trying to download from source
Installing laravel/socialite (v5.1.0): Cloning 14082c6651 from cache
guzzlehttp/psr7 suggests installing laminas/laminas-httphandlerrunner (Emit PSR-7 responses)
guzzlehttp/guzzle suggests installing ext-intl (Required for Internationalized Domain Name (IDN) support)
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Writing lock file
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
#php artisan package:discover --ansi
In ProviderRepository.php line 149:
Call to undefined method Laravel\Socialite\Facades\Socialite::isDeferred()
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.
update: upgrading from the laravel 5 way of declaring provide class in config/app, this ended up conflicting with laravel 6 package auto discovery, therefore causing even php artisan config:clear and composer dump-autoload not to work. removing 'Socialite' => Laravel\Socialite\Facades\Socialite::class in config/app.php solved this issue and re-installing the socialite package

Laravel composer TypeError during installation

I have a little problem with my composer.
I'm using laragon on windows so everything is 'made' for me.
I've installed using composer require pragmarx/tracker command, and it was fine.
But because I'm a bit stupid I thought it was causing some problems so I've removed it with composer remove pragmarx/tracker. Now I want to reinstall it, but I got the following problem.
I can't find a solution anywhere, and I don't really understand the problem.
C:\laragon\www\Portfolio (master)
λ composer require pragmarx/tracker
Using version ^4.0 for pragmarx/tracker
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 12 installs, 0 updates, 0 removals
- Installing jaybizzle/crawler-detect (v1.2.96): Loading from cache
- Installing snowplow/referer-parser (0.2.0): Loading from cache
- Installing pragmarx/datatables (v1.4.12): Loading from cache
- Installing composer/ca-bundle (1.2.7): Loading from cache
- Installing ua-parser/uap-php (v3.9.13): Loading from cache
- Installing mobiledetect/mobiledetectlib (2.8.34): Loading from cache
- Installing jenssegers/agent (v2.6.4): Loading from cache
- Installing pragmarx/support (0.9.2): Loading from cache
- Installing doctrine/event-manager (1.1.1): Loading from cache
- Installing doctrine/cache (1.10.2): Loading from cache
- Installing doctrine/dbal (2.10.2): Loading from cache
- Installing pragmarx/tracker (v4.0.0): Loading from cache
snowplow/referer-parser suggests installing symfony/yaml (Support for YAML configuration file)
ua-parser/uap-php suggests installing symfony/yaml (Required for CLI usage - ^3.4 || ^4.3 || ^5.0)
ua-parser/uap-php suggests installing symfony/filesystem (Required for CLI usage - ^3.4 || ^4.3 || ^5.0)
pragmarx/support suggests installing symfony/yaml (The Yaml class needs it)
doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
pragmarx/tracker suggests installing geoip/geoip (~1.14)
pragmarx/tracker suggests installing geoip2/geoip2 (~2.0)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
TypeError
Argument 1 passed to UAParser\Parser::parse() must be of the type string, null given, called in C:\laragon\www\Portfolio\vendor\pragmarx\tracker\src\Support\UserAgentParser.php on line 25
at C:\laragon\www\Portfolio\vendor\ua-parser\uap-php\src\Parser.php:37
33| $this->userAgentParser = new UserAgentParser($this->regexes);
34| }
35|
36| /** Sets up some standard variables as well as starts the user agent parsing process */
> 37| public function parse(string $userAgent, array $jsParseBits = []): Client
38| {
39| $client = new Client($userAgent);
40|
41| $client->ua = $this->userAgentParser->parseUserAgent($userAgent, $jsParseBits);
1 C:\laragon\www\Portfolio\vendor\pragmarx\tracker\src\Support\UserAgentParser.php:25
UAParser\Parser::parse()
2 C:\laragon\www\Portfolio\vendor\pragmarx\tracker\src\Vendor\Laravel\ServiceProvider.php:174
PragmaRX\Tracker\Support\UserAgentParser::__construct("C:\laragon\www\Portfolio")
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.
EDIT 1:
The result of composer dump-autoload is:
composer dump-autoload
Generating optimized autoload files> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
TypeError
Argument 1 passed to UAParser\Parser::parse() must be of the type string, null given, called in C:\laragon\www\Portfolio\vendor\pragmarx\tracker\src\Support\UserAgentParser.php on line 25
at C:\laragon\www\Portfolio\vendor\ua-parser\uap-php\src\Parser.php:37
33| $this->userAgentParser = new UserAgentParser($this->regexes);
34| }
35|
36| /** Sets up some standard variables as well as starts the user agent parsing process */
> 37| public function parse(string $userAgent, array $jsParseBits = []): Client
38| {
39| $client = new Client($userAgent);
40|
41| $client->ua = $this->userAgentParser->parseUserAgent($userAgent, $jsParseBits);
1 C:\laragon\www\Portfolio\vendor\pragmarx\tracker\src\Support\UserAgentParser.php:25
UAParser\Parser::parse()
2 C:\laragon\www\Portfolio\vendor\pragmarx\tracker\src\Vendor\Laravel\ServiceProvider.php:174
PragmaRX\Tracker\Support\UserAgentParser::__construct("C:\laragon\www\Portfolio")
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Error when installing package with composer but package seems installed anyway

I'm trying to install the package maddhatter/laravel-fullcalendar (Laravel helper for FullCalendar.io) with composer.
So here is the command I run:
'''
php ../../composer.phar require maddhatter/laravel-fullcalendar
'''
And here is the result:
Using version ^1.3 for maddhatter/laravel-fullcalendar
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing maddhatter/laravel-fullcalendar (v1.3.0): Downloading (100%)
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
php artisan clear-compiled
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()
Script php artisan clear-compiled handling the post-update-cmd event returned with error code 255
But now I wonder if the package is installed or not, because it now appears in my list of installed packages.
If anyone has the answer, thanks in advance.
Try to delete file compiled.php in your vendor directory manually, and then it started to work again.

JmsSerializerBundle installation ends with error: Unrecognized option "xml" under "jms_serializer.visitors"

When I install a Symfony 4 skeleton project and add the JmsSerializerBundle, I get an error.
To reproduce:
composer create-project symfony/website-skeleton myproject
cd myproject
composer require jms/serializer-bundle
The installation ends with an error:
Using version ^3.0 for jms/serializer-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.1.*"
Package operations: 16 installs, 0 updates, 0 removals
- Installing hoa/exception (1.17.01.16): Loading from cache
- Installing hoa/event (1.17.01.13): Loading from cache
- Installing hoa/consistency (1.17.05.02): Loading from cache
- Installing hoa/visitor (2.17.01.16): Loading from cache
- Installing hoa/ustring (4.17.01.16): Loading from cache
- Installing hoa/protocol (1.17.01.14): Loading from cache
- Installing hoa/zformat (1.17.01.10): Loading from cache
- Installing hoa/iterator (2.17.01.10): Loading from cache
- Installing hoa/compiler (3.17.08.08): Loading from cache
- Installing hoa/regex (1.17.01.13): Loading from cache
- Installing hoa/math (1.17.05.16): Loading from cache
- Installing hoa/stream (1.17.02.21): Loading from cache
- Installing hoa/file (1.17.07.11): Loading from cache
- Installing jms/metadata (2.0.0): Loading from cache
- Installing jms/serializer (2.0.0): Loading from cache
- Installing jms/serializer-bundle (3.0.0): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 1 recipe (f702450e5b1b913f83ea887faacbdb83)
- WARNING jms/serializer-bundle (>=2.0): From github.com/symfony/recipes-contrib:master
The recipe for this package comes from the "contrib" repository, which is open to community contributions.
Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/jms/serializer-bundle/2.0
Do you want to execute this recipe?
[y] Yes
[n] No
[a] Yes for all packages, only for the current installation session
[p] Yes permanently, never ask again for this project
(defaults to n): y
- Configuring jms/serializer-bundle (>=2.0): From github.com/symfony/recipes-contrib:master
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In ArrayNode.php line 304:
!!
!! Unrecognized option "xml" under "jms_serializer.visitors"
Running composer etc on Windows 10 Powershell. I'm guessing the skeleton is too bare and it needs a dependency, but shouldn't that be solved automatically?
What could be the cause? How can I fix it? Thanks in advance for your help.
The current recipe is not compatible with JMSSerializerBundle 3 (there is a pending pull request, see https://github.com/symfony/recipes-contrib/pull/559). So for now, you need to adapt the configuration manually.

Laravel 5.2 - Artisan Optimize - Class 'TestMakeCommand' not found

I run my local environment on docker /w shared code volumes.
When my Dockerfile runs php artisan optimize it fails with...
Step 14/15 : RUN composer install && composer update
---> Running in 94698cafb7bf
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 0 installs, 2 updates, 0 removals
- Updating aws/aws-sdk-php (3.30.0 => 3.30.2): Downloading (100%)
- Updating barryvdh/laravel-ide-helper (v2.3.2 => v2.4.0): Downloading (100%)
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Illuminate\Foundation\Console\TestMakeCommand' not found
Script php artisan optimize handling the post-install-cmd event returned with error code 1
However, it I run locally php artisan optimize it works fine, and also if I remove that from composer.json it will build fine and I can run it on the container with no issues, I don't understand the difference why it wouldn't run when building the container?

Categories