Illuminate/Support not loaded while trying to install nunomaduro/larastan

Hello there friends. As part of following the Pet Clinic project and learn the filament admin inside out I decided to start fresh (I've joined later than the first class the livestream) so I've just created a new petclinic.lar project locally and it is all set, but when I attempt to follow up with the video and install larastan, I got a weird error using the composer command: composer require nunomaduro/larastan:^2.0 --dev:
PS C:\OpenServer\domains\petclinic.lar> composer require nunomaduro/larastan:^2.0 --dev
./composer.json has been updated
Running composer update nunomaduro/larastan
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 nunomaduro/larastan 2.0 -> satisfiable by nunomaduro/larastan[2.0.0].
- nunomaduro/larastan 2.0.0 requires illuminate/console ^9 -> found illuminate/console[v9.0.0, ..., v9.52.15] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.
PS C:\OpenServer\domains\petclinic.lar> composer require nunomaduro/larastan:^2.0 --dev
./composer.json has been updated
Running composer update nunomaduro/larastan
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 nunomaduro/larastan 2.0 -> satisfiable by nunomaduro/larastan[2.0.0].
- nunomaduro/larastan 2.0.0 requires illuminate/console ^9 -> found illuminate/console[v9.0.0, ..., v9.52.15] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Does anyone has an idea what might be wrong as it is a brand new project using PHP 8.1, any other packages were correctly installed and project ready to go, just that I would like to see what larastan does as well and seems to have an issue with that... I've read in StackOver that I should check my composer.json and remove any Illuminate\Support if there and do a composer update, but that did not help much and I did not even had that line.
Solution:
Here is the final result, seems like the .neon file got accepted perfectly and tests passed with flying colors:
No description
Jump to solution
10 Replies
MilenKo
MilenKoOPā€¢15mo ago
Not really a cool start but at least it adds some spiciness to the project. I've found in Laracast someone else having the same issue and stating that it got fixed by installing laravel/ui. Since we will use breeze in this project, I will move forward and get back to larastan later to see if that helps or not šŸ˜‰
tuto1902
tuto1902ā€¢15mo ago
That's really strange. I just did a fresh install and the installation went smoothly
laravel new laravel-test
cd laravel-test
composer require nunomaduro/larastan:^2.0 --dev
laravel new laravel-test
cd laravel-test
composer require nunomaduro/larastan:^2.0 --dev
is this your local machine or a remote one?
MilenKo
MilenKoOPā€¢15mo ago
A local machine with over 30 projects on it fully working, filament or other admins, all good, just this package that is not installing. That is OK, I will see throughout the progress as we need to install Breeeze with filament which is a replacement for laravel/ui so hopefully that changes something and I am able to install it šŸ™‚ Out of curiosity, I've tried installing laravel/ui, nothing changed so larastan so far did not work. I will have to troubleshoot separately I guess as to stick to the project closely and catch up first before I have something to troubleshoot. Besides, since you promissed to write some tests, that could be another alternative to make sure my code is correctly functioning šŸ˜‰ Strangely enough, even after having Filament fully ready to serve, I am still getting the same error, I am not sure how to interpret even the error itself as it says I am having a requirement of Illuminate/console ^9, says it found Illuminate/console[v9.0.0-beta.1, ..., 9.x-dev] but any of those is not loaded or conflicts with another require but does not list it. Does anybody know how can I specifically load the console as I thought we don't need to have an occurrence of it in config.json as it is used by Laravel framework but I might be wrong?
tuto1902
tuto1902ā€¢15mo ago
Whenever I have issues with composer that I just can't understand, and it does not happen on other newly installed projects, I just go nuclear and delete the vendor folder and the composer.lock file. Then I clear the composer cache with composer clear-cache and rm -rf ~/.composer/cache/* just to be safe. Then I run composer install again.
MilenKo
MilenKoOPā€¢15mo ago
I like the Nuclear approach - if nothing else works, what would be the worse that can happen other than you have to restore your project from git and get back on horse. Let me try and I will share the outcome šŸ™‚ Weird enough, followed all the steps to sabotage my project and after rebuilding the vendors with composer install, I got into the same issue. Anyway, I would say ELMO (-Enough, Lets Move On) for now, I've filed an issue on the dev git so we shall see as I've tested on two other systems and got still the same identical issue. I have another test to try - using a Laravel container but if it fails there, I am speechless why it is always me with some funny issues that others won't be bothered with. I am thinking only of one last thing to try, if @tuto1902 could share his config.json from a project that worked to require correctly the larastan, so that I can place it in my project and see if something happens with a missing include/requirement or somewhere else šŸ˜‰
tuto1902
tuto1902ā€¢15mo ago
of course I'm assuming you mean composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
MilenKo
MilenKoOPā€¢15mo ago
Yeah, sorry my bad. Will do a last try to install with your composer but will first compare to see what could be the difference (if any). It might sound strange, but even with your composer.json I am not able to install it after. Strangely enough, since you had the larastan in required it should have failed to install but it did succeed to finish the installation of vendors without an error. The only issue is that when I go to /vendors/nunomaduro, I did not find larastan in there but only: - collision - termwind Seems like this package won't be used for now by me or until I figure out what the issue really is. I believe this is a glitch as I just setup a new project on the same system with laravel and marked as minimum stability: "dev" and it worked to install. So to me it is a case closed as I can always import the project files to the new project that has larastan and be done with it. Thanks for the shared files, ideas etc. šŸ’¼
Solution
MilenKo
MilenKoā€¢15mo ago
Here is the final result, seems like the .neon file got accepted perfectly and tests passed with flying colors:
No description
MilenKo
MilenKoOPā€¢15mo ago
Now the case is trully closed :))))))))
Want results from more Discord servers?
Add your server