Class Wikibase\DataModel\Entity\ItemId not found WikiBase installation - php

I am currently trying to follow this tutorial: https://www.mediawiki.org/wiki/Wikibase/Installation
I have the latest version of both MediaWiki and WikiBase (1.35) I'm currently trying to run the maintenance scripts.
I have installed both Wikibase Repository and Wikibase Client.
When I try to run "php maintenance/update.php" it gives me this error:
Error from line 47 of /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/lib/WikibaseLib.entitytypes.php: Class "Wikibase\DataModel\Entity\ItemId" not found
#0 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/repo/includes/WikibaseRepo.php(695): require()
#1 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/repo/includes/WikibaseRepo.php(410): Wikibase\Repo\WikibaseRepo::getDefaultEntityTypes()
#2 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/repo/includes/WikibaseRepo.php(460): Wikibase\Repo\WikibaseRepo::newInstance()
#3 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/repo/includes/RepoHooks.php(115): Wikibase\Repo\WikibaseRepo::getDefaultInstance()
#4 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/HookContainer/HookContainer.php(321): Wikibase\Repo\RepoHooks::onSetupAfterCache()
#5 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/HookContainer/HookContainer.php(132): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#6 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/HookContainer/HookRunner.php(3417): MediaWiki\HookContainer\HookContainer->run(string, array)
#7 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/Setup.php(694): MediaWiki\HookContainer\HookRunner->onSetupAfterCache()
#8 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/WebStart.php(89): require_once(string)
#9 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/index.php(44): require(string)
#10 {main}
How can I fix this? I've tried updating Composer and reinstalling it numerous times. If anyone can help, that would be great! :)

I hit the same error, and in my case, it was because my compose.local.json, (copied from composer.local.json-sample,) was pointing to "extensions/example/composer.json" rather than "extensions/Wikibase/composer.json". Fixing this to Wikibase, deleting composer.lock, running composer install --no-dev again, and finally running update.php fixed the issue.

Related

Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable

I'm upgrading Laravel from 5.2 to 5.3
I followed the steps mentioned here:
https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0
When I tried to to do composer update I kept getting:
[2021-04-12 06:15:52] build.ERROR: exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable.' in XXXXXXXXXXXX/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php:763
#0 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build('Illuminate\\Cont...', Array)
#1 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#2 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php(1203): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#3 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(175): Illuminate\Container\Container->offsetGet('Illuminate\\Cont...')
#4 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(144): Illuminate\Support\Facades\Facade::resolveFacadeInstance('Illuminate\\Cont...')
#5 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(231): Illuminate\Support\Facades\Facade::getFacadeRoot()
#6 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php(25): Illuminate\Support\Facades\Facade::__callStatic('policy', Array)
#7 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php(25): Illuminate\Support\Facades\Gate::policy('XXXXXX\\Model', 'XXXXXXX\\Polic...')
#8 /Users/ahmad/Projects/admin/app/Providers/AuthServiceProvider.php(26): Illuminate\Foundation\Support\Providers\AuthServiceProvider->registerPolicies()
#9 [internal function]: XXXXXX\Providers\AuthServiceProvider->boot()
I added the Gate to my providers array, and tried clearing the bootstrap cache folder and delete the vendor, and reinstall everything in the composer.json
Any advises?
When you upgrade from an older version of Laravel, it may contain some old files or code which are not needed. In my case, I needed to update config/app.php file as per the latest code and it fixed the error.

Fatal error: Uncaught ReflectionException: Class config does not exist

I'm working on an e-commerce project on Laravel 5.8, but since I accidently ran "laravel new" command on the project's folder I get this error when I'm trying to launch the project on a local server:
Fatal error: Uncaught ReflectionException: Class config does not exist in C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php:788
Stack trace:
0 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(788): ReflectionClass->__construct('config')
1 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(667): Illuminate\Container\Container->build('config')
2 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(615): Illuminate\Container\Container->resolve('config', Array)
3 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(767): Illuminate\Container\Container->make('config', Array)
4 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(1227): Illuminate\Foundation\Application->make('config')
5 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Log\LogManager.php(417): Illuminate\Container\C in C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 788"
The error on line 788 refers to that portion of code:
$reflector = new ReflectionClass($concrete)
This happened after I cloned my repo from Github. Now for every project that I try to run on a local server I get this error.
I tried "composer install", "composer update", "composer dump-autoload" but they all give the same error with this line at the end:
"Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255".
I checked the .env file to see if there was a namespace issue too, but there's none of it.
Thank you in advance for your help.
Try to remove de files in:
cd bootstrap/cache/
rm -rf *.php
In this directory are the file that initializes the structure, cache directory that contains structure-generated files for performance optimization, such as files and route cache services.
You may check the following items
Check whether your APP_NAME has space. If space is there, use it in quotes.
Delete everything from bootstrap/cache/ folder.
run composer dump-autoload
Hope it will work
I tried #gulCunha 's answer and it worked.
After that, you have to run composer update in order to create a new composer.lock and php artisan config:cache after that and you should be good to go.
Did you change the .env file,mistakenly I have added a "APP_NAME=aaa aa " with spaces, then checked every where, after that APP_NAME= changed without spaces, now working charm.
I was creating a new Laravel 9 project with composer and got the same error.
Fatal error: Uncaught ReflectionException: Class "config" does not exist in .../vendor/laravel/framework/src/Illuminate/Container/Container.php:875
Stack trace:
#0 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(875): ReflectionClass->__construct('config')
#1 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build('config')
#2 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(855): Illuminate\Container\Container->resolve('config', Array, true)
#3 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve('config', Array)
#4 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(840): Illuminate\Container\Container->make('config', Array)
#5 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(1415): Illuminate\Foundation\Application->make('config')
#6 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(515): Illuminate\Container\Container->offsetGet('config')
#7 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(566): Illuminate\Log\LogManager->getDefaultDriver()
#8 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(119): Illuminate\Log\LogManager->parseDriver(NULL)
#9 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(702): Illuminate\Log\LogManager->driver()
#10 .../vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(274): Illuminate\Log\LogManager->log('error', 'substr(): Argum...', Array)
#11 .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(367): Illuminate\Foundation\Exceptions\Handler->report(Object(TypeError))
#12 .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException(Object(TypeError))
#13 .../artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 {main}
Next Illuminate\Contracts\Container\BindingResolutionException: Target class [config] does not exist. in .../vendor/laravel/framework/src/Illuminate/Container/Container.php:877
Stack trace:
#0 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build('config')
#1 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(855): Illuminate\Container\Container->resolve('config', Array, true)
#2 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve('config', Array)
#3 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(840): Illuminate\Container\Container->make('config', Array)
#4 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(1415): Illuminate\Foundation\Application->make('config')
#5 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(515): Illuminate\Container\Container->offsetGet('config')
#6 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(566): Illuminate\Log\LogManager->getDefaultDriver()
#7 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(119): Illuminate\Log\LogManager->parseDriver(NULL)
#8 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(702): Illuminate\Log\LogManager->driver()
#9 .../vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(274): Illuminate\Log\LogManager->log('error', 'substr(): Argum...', Array)
#10 .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(367): Illuminate\Foundation\Exceptions\Handler->report(Object(TypeError))
#11 .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException(Object(TypeError))
#12 .../artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 {main}
thrown in .../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 877
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
But this time it was not about the cache. Regardless of what the errors suggest, the problem was actually caused by the following lines found in vendor/vlucas/phpdotenv/src/Util/Str.php
$converted = $encoding === null ?
#\mb_convert_encoding($input, 'UTF-8') :
#\mb_convert_encoding($input, 'UTF-8', $encoding);
It actually occurred as I didn't have Multibyte String enabled when I built my PHP binaries. After rebuilding PHP with --enable-mbstring, the problem went away.
Make sure your .env file is the exact same as in your local environment. Make sure that the values on your .env file don't have spaces. Those that have spaces should be wrapped in quotes
I had a similar problem. Here is how I fixed it.
It started when I installed Toastr in my config/app.php providers.
I had failed to add the trailing ",".
Hence the problem.
Solution:
Check the last package you installed.
Check if you have added it correctly in the service providers.
You should run 'composer update' command, and then 'php artisan optimize' to clear the config cache and routes.

FatalThrowableError in ProviderRepository.php line 146: Class 'Laravel\Socialite\SocialiteServiceProvider' not found

I have looked at a lot of these questions already and have tried clear cache, composer update. None have worked. I get this error and I cannot figure it out.
here is my log:
[2016-09-17 04:08:29] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Class 'Laravel\Socialite\SocialiteServiceProvider' not found in /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:146
Stack trace:
#0 /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(114): Illuminate\Foundation\ProviderRepository->createProvider('Laravel\\Sociali...')
#1 /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(60): Illuminate\Foundation\ProviderRepository->compileManifest(Array)
#2 /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(540): Illuminate\Foundation\ProviderRepository->load(Array)
#3 /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders()
#4 /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application))
#5 /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(253): Illuminate\Foundation\Application->bootstrapWith(Array)
#6 /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->bootstrap()
#7 /home4/office/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#8 /home4/office/public_html/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#9 {main}
Any help would be nice as I don't know if I'm missing something but I followed the install procedure from the git.
I fixed it:
if anybody else has this problem it came down to the composer itself. I had to uninstall and reinstall the composer. I'm guessing the composer was not installing and/or autoloading the files right.

antonioribeiro/firewall package throwing errors after upgrading to laravel 5.2.5?

I am working on a laravel application and decided to use antonioribeiro/firewall to manage IP restrictions throughout my application. The package is awesome and worked like a charm. Until recently when I upgraded to the latests laravel version 5.2.5 when the package started throwing and error, the stack to which I am pasting below:
[2015-12-29 09:23:20] local.ERROR: exception 'BadMethodCallException' with message 'Method filter does not exist.' in /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:81
Stack trace:
#0 /home/vagrant/Code/archive/vendor/pragmarx/firewall/src/Vendor/Laravel/ServiceProvider.php(163): Illuminate\Routing\Router->__call('filter', Array)
#1 /home/vagrant/Code/archive/vendor/pragmarx/firewall/src/Vendor/Laravel/ServiceProvider.php(163): Illuminate\Routing\Router->filter('fw-block-bl', '\\PragmaRX\\Firew...')
#2 /home/vagrant/Code/archive/vendor/pragmarx/firewall/src/Vendor/Laravel/ServiceProvider.php(67): PragmaRX\Firewall\Vendor\Laravel\ServiceProvider->registerFilters()
#3 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(531): PragmaRX\Firewall\Vendor\Laravel\ServiceProvider->register()
#4 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(74): Illuminate\Foundation\Application->register(Object(PragmaRX\Firewall\Vendor\Laravel\ServiceProvider))
#5 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(507): Illuminate\Foundation\ProviderRepository->load(Array)
#6 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders()
#7 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application))
#8 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(208): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(105): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 /home/vagrant/Code/archive/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 {main}
Now I am not an expert but I think this line:
$this->app['router']->filter('fw-block-bl', '\PragmaRX\Firewall\Filters\Blacklist');
is responsible for throwing the error. My best guess is that maybe filters are deprecated in 5.2.5 and there is no longer a filter method or maybe it was renamed to something else. In either case I don't know how to fix this. I am not using the filters that ship with the package as it is. I have written my own custom middleware to work with. How do I go around this problem?
So I had not updated to the newer version of the package available and the even more frustrating problem I faced was that the newer package bundled the older version (~0.5) of the support package from the same user and I had to forcefully update to the newer version (~0.6) of the support package too.
Github issue

Laravel Excel Installation

I've just used composer to get Maatwebsite Laravel-Excel. I am about to use it but I am brand new to installing/using packages. So far I've only used what is shipped with Laravel.
I'm reading the documentation and am following the steps (I've done the first three steps) but I am confused by this line;
The class is binded to the ioC as excel
$excel = App::make('excel');
I don't really know what most of that means. I have read up a little on ioC and then Dependency Injection (also new to me). But I still don't know - is this part of the docs telling me to do something?? I ran php artisan on the command line (for another purpose) and I got this back;
[2015-04-23 13:42:09] local.ERROR: exception 'BadMethodCallException' with message 'Call to undefined method [package]' in /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:226
Stack trace:
#0 /vagrant/source/laravel-excel/vendor/maatwebsite/excel/src/Maatwebsite/Excel/ExcelServiceProvider.php(45): Illuminate\Support\ServiceProvider->__call('package', Array)
#1 /vagrant/source/laravel-excel/vendor/maatwebsite/excel/src/Maatwebsite/Excel/ExcelServiceProvider.php(45): Maatwebsite\Excel\ExcelServiceProvider->package('maatwebsite/exc...')
#2 [internal function]: Maatwebsite\Excel\ExcelServiceProvider->boot()
#3 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#4 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(703): Illuminate\Container\Container->call(Array)
#5 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(685): Illuminate\Foundation\Application->bootProvider(Object(Maatwebsite\Excel\ExcelServiceProvider))
#6 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(Maatwebsite\Excel\ExcelServiceProvider), 19)
#7 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(686): array_walk(Array, Object(Closure))
#8 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(15): Illuminate\Foundation\Application->boot()
#9 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(181): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#10 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(195): Illuminate\Foundation\Application->bootstrapWith(Array)
#11 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(92): Illuminate\Foundation\Console\Kernel->bootstrap()
#12 /vagrant/source/laravel-excel/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 {main}
php artisan ran sucessfully when I took out the maatwebsite references in config/app.php - so there must be more to do here but I don't know what.
Looks like the documentation is listing the wrong version. The 1.x branch is meant for Laravel 4.x. The GitHub page provides a better guide for Laravel 5 users. Try changing the version to 2.* in your composer.json and re-run composer update. Add the correct references back to your app.php you should be able to run php artisan without errors.
The App::make('excel') command should also work after that.

Categories