Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class "Spatie\LaravelPackageTools\PackageServiceProvider" not found #66

Closed
anchovie91471 opened this issue Sep 2, 2024 · 13 comments
Closed

Comments

@anchovie91471
Copy link

I installed this package in Laravel 10.48.20/PHP 8.2.22 and got the following error:

`Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi

In ApprovalServiceProvider.php line 8:

Class "Spatie\LaravelPackageTools\PackageServiceProvider" not found

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
`
Any idea why this would happen?

@cjmellor
Copy link
Owner

cjmellor commented Sep 2, 2024

I'm not sure, sorry. More than likely unique to yourself and your setup. Maybe try removing the vendor folder and composer.lock and try re-run Composer. Make sure the versions match up etc.

If those fail, I'm afraid I don't know the answer.

@anchovie91471
Copy link
Author

OK. Thank you!

@anchovie91471
Copy link
Author

That worked! Thank you again!

@To-heeb
Copy link

To-heeb commented Jan 28, 2025

I still have the same issue, I have done the above and it is still the same

@mojowill
Copy link
Contributor

I'm seeing the same issue on a fresh install on a pretty fresh Laravel install.

@cjmellor
Copy link
Owner

Hmm, I'll see if I can replicate and if so, sort something out.

@mojowill
Copy link
Contributor

I was able to work around by explicitly requiring Spaties package tools as a requirement (not dev)

@cjmellor
Copy link
Owner

Interesting. Will still take a look. Ideally I want to take out all the Spatie stuff, it just causes problems

@mojowill
Copy link
Contributor

mojowill commented Jan 29, 2025

Interesting. Will still take a look. Ideally I want to take out all the Spatie stuff, it just causes problems

According to their Package Skeleton, package tools should be in the main require not require-dev.

https://github.com/spatie/package-skeleton-laravel/blob/main/composer.json

@cjmellor
Copy link
Owner

Thanks for the guidance! I'll change it tomorrow, or if anyone wants to do a PR 😜

@mojowill
Copy link
Contributor

PR raised

@To-heeb
Copy link

To-heeb commented Jan 29, 2025

Thanks @mojowill and @cjmellor, I will now be able to use it with no issue, will keep an eye on the PR when it is merged.

PR raised

@cjmellor
Copy link
Owner

Fixed via #72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants