I'm currently in 7.5.0 and I want to upgrade to 8.0.3, I followed the steps in https://yajrabox.com/docs/laravel-datatables/master/upgrade but I encountered this error
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating yajra/laravel-datatables-oracle (v7.5.0 => v8.0.3): Downloading (conneDownloading (100%)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Yajra\Datatables\DatatablesServiceProvider' not found
Script php artisan optimize handling the post-update-cmd event returned with error code 1
Installation failed, reverting ./composer.json to its original content.
In the Yajra DataTables V8 the Namespace and Facade was updated.
https://yajrabox.com/docs/laravel-datatables/master/upgrade#namespace
https://yajrabox.com/docs/laravel-datatables/master/upgrade#facade
In folder config/app.php, temporarily comment out
Yajra\Datatables\DatatablesServiceProvider.
Run command composer update.
Uncomment the provider Yajra\Datatables\DatatablesServiceProvider.
Done.
To make sure it works, can run again command composer update.
Reference from: https://yajrabox.com/docs/laravel-datatables/master/upgrade#v5-to-v6
Related
I am developing this package: https://github.com/craftisan/laravel-seo as an extension for laravel-admin and while requiring it via composer into a laravel project, I am getting this error (see github issue here):
% composer require craftisan/laravel-seo --ignore-platform-reqs
Using version dev-master for craftisan/laravel-seo
./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 craftisan/laravel-seo (dev-master 96e32bc): Cloning 96e32bc192 from cache
Package moontoast/math is abandoned, you should avoid using it. Use brick/math instead.
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Installation failed, reverting ./composer.json to its original content.
I tried debugging a lot, checked config file syntax, even dumped output all the way from package:discover command in artisan, didn't find anything.
storage/ & bootstrap/cache is writeable
rm -rf bootstrap/cache done
Any ideas why this could be happening?
Fixed
Installed the same package in a fresh laravel application. Apparently the relative link to config file was broken but composer install wasn't giving error trace. Missed preceding / after __DIR__:
// Publish configuration
$this->publishes([
__DIR__ . '../config/seo.php' => config_path('seo.php'),
// fix: __DIR__ . '/../config/seo.php' => config_path('seo.php'),
], 'seo');
I have create a simple Laravel Package and pushed it on Github
https://github.com/akshaykhale1992/model-notes
and Published the Package on Packagist
https://packagist.org/packages/akshaykhale1992/model-note
I tried to install it in my laravel application, it pulled the package from Github but the package installation was not successful.
Below is the Error that is returned by composer command
root#root.com:~/$ composer require akshaykhale1992/model-note
Using version dev-master for akshaykhale1992/model-note
./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 akshaykhale1992/model-note (dev-master 5543914): Cloning 554391487e from cache
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover
In ProviderRepository.php line 208:
Class 'AkshayKhale1992\ModelNote\ModelNoteProvider' not found
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
Thanks in advance.
Terminal Screenshot
In order for composer to properly generate the autoload file for your package (as well as all packages) it needs to know where to find the namespaces and files that are referenced. This is done via the autoload entry in composer.json
In your case, since you are already following the PSR-4 standard you need something like:
"autoload": {
"psr-4": {
"AkshayKhale1992\\ModelNote\\": "src/"
}
}
After clone the git repo, install composer and Laravel , this error will come out. Anyone can solve this error?
When I run laravel new, I get this error:
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
> php -r "file_exists('.env') || copy('.env.example', '.env');"
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
Script php artisan optimize handling the post-install-cmd event returned with error code 255
Application ready! Build something amazing.
Which repo you cloned? if you want create a new laravel project, just try run laravel new projectName,
check the doc here
After installing illuminate/html, my blade engine was wrrking well. But when I installed simple qrCode via:
"require": {
"simplesoftwareio/simple-qrcode": "~1"
}
I get this error:
Class 'Illuminate\Html\HtmlServiceProvider' not found
the output of terminal after installation, simple qrcode was:
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/bin/composer self-update" to get the latest version.
Key require is a duplicate in ./composer.json at line 53
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing illuminate/html (v5.0.0)
- Installing bacon/bacon-qr-code (1.0.1)
Downloading: 100%
- Installing simplesoftwareio/simple-qrcode (1.4.3)
Downloading: 100%
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
PHP Fatal error: Class 'Illuminate\Html\HtmlServiceProvider' not found in /home/farhad/public_html/letterPanel/laravel/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Illuminate\Html\HtmlServiceProvider' not found
Script php artisan optimize handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'Illuminate\Html\HtmlServiceProvider' not found in /home/farhad/public_html/letterPanel/laravel/vendor/lara
vel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
I also ran composer require illuminate/html after this error. But I get that same error.
Your composer.json file has two require keys, as mentioned in the composer error in your question:
Key require is a duplicate in ./composer.json at line 53
Remove to have a correctly formed composer.json file and retry.
You're installing module for Laravel 4 on Laravel 5 project. Html package was removed from Laravel 5.
You can look for another package or you could install Html package and adapt qrcode to work with Laravel 5.
The line "simpleoftwareio / simple-qrcode": "~ 1" must be within "require" that is already in your composer.json.
I am trying to update composer in a Laravel 4 project, but I get this error:
[RuntimeException] Could not load package psy/psysh in
http://packagist.org: [UnexpectedValueException] Could not parse
version constraint ^2.4.2: Invalid version string "^2.4.2"
I haven't used psy/psysh within my project. Why is this returned? How can I solve this and run composer update?
The ^ character in version strings is a relatively new composer feature. Update your version of the package manager and you should be good to go
composer self-update