I have this Laravel composer.json that's automatically created after running composer create-project --prefer-dist laravel/laravel blog.
Unfortunately when I run a composer install. It's only installing 38 instead of 26 required packages.
The error message on the website is:
Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found
Composer configuration:
{
"name": "laravel-distro",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"laravel/installer": "^2.0.1"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"vendor-dir": "vendor",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
Installed packages:
[laravel-distro &cli-image laravel-distro]php:/app$ ls vendor
autoload.php composer doctrine egulias fideloper jakub-onderka league nesbot opis phpoption psy ramsey symfony vlucas
bin dnoegel dragonmantank erusev guzzlehttp laravel monolog nikic paragonie psr ralouphie swiftmailer tijsverkoyen
[laravel-distro &cli-image laravel-distro]php:/app$ ls vendor_backup/
autoload.php composer dragonmantank fideloper hamcrest league myclabs nunomaduro phar-io phpspec psy swiftmailer tijsverkoyen
beyondcode dnoegel egulias filp jakub-onderka mockery nesbot opis phpdocumentor phpunit ramsey symfony vlucas
bin doctrine erusev fzaninotto laravel monolog nikic paragonie phpoption psr sebastian theseer webmozart
[laravel-distro &cli-image laravel-distro]php:/app$
I believe the problem might be that composer.lock is not synchronized with composer.json. Try to run
composer install
and make sure you don't have message like this:
The lock file is not up to date with the latest changes in composer.json
If you do, it means someone forgot to commit composer.lock - the easiest solution is to run:
composer update
that will cause that all packages will be updated (it might cause some problems if something in package was changed) but it should also install all the packages that are not in composer.lock file but are listed in composer.json
Related
I'm getting this error while installing Laravel Jetstream:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/jetstream[v2.3.0, ..., 2.x-dev] require league/commonmark ^1.3 -> found league/commonmark[1.3.0, ..., 1.6.x-dev] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires laravel/jetstream ^2.3 -> satisfiable by laravel/jetstream[v2.3.0, ..., 2.x-dev].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
it's a fresh installed Laravel Framework 8.51.0
I try these answers but it does not work for me, so I try this one.
first, should install Jetstream in a new Laravel application (read this doc from Jetstream laravel :https://jetstream.laravel.com/2.x/installation.html).
first step:
install new laravel project version 8
composer require laravel/jetstream:*
and it's done
continue the installation for the jetstream
The Laravel 8 docs not clear. You can fix it by following commands:
php artisan jetstream:install livewire
npm install && npm run dev
Reference:
https://github.com/laravel/jetstream#installation
https://laracasts.com/discuss/channels/inertia/laravel-8-jetstream-livewire-inertia-error
This command:
composer require laravel/jetstream
also generated the same errors as you for me, but this other command works fine:
composer require laravel/jetstream:*
I try to install fresh laravel (specific laravel project like this):
composer create-project --prefer-dist laravel/laravel:^8.0 olshop-larafel
then inside into this project
cd olshop-larafel
And install laravel/jetstream:
composer require laravel/jetstream
All works fine. Have you tried to install laravel 8.0 specific version?
Or maybe this article will help you
Information, this is my composer.json file:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/jetstream": "^2.3",
"laravel/tinker": "^2.0"
},
"require-dev": {
"facade/ignition": "^2.3.6",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
When I tried to install laravel breeze, using command composer require laravel/breeze --dev, it gives me this error:
Using version ^1.2 for laravel/breeze
./composer.json has been updated
Running composer update laravel/breeze
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/breeze[v1.2.0, ..., 1.x-dev] require illuminate/filesystem ^8.42 -> found illuminate/filesystem[v8.42.0, v8.42.1, v8.43.0, 8.x-dev] but it conflicts with another require.
- Root composer.json requires laravel/breeze ^1.2 -> satisfiable by laravel/breeze[v1.2.0, v1.2.1, 1.x-dev].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
My current version of laravel : laravel8.
I'm trying to add an users's authentification session on an existing application.
My composer.json file :
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.2",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
You need to update your dependencies listed here
Maybe you will not find "laravel/ui" in your composer.json, if it's the case add to it manually as a property from the parent "require".
Then you have to save the file and run on the terminal the command: composer update
Follows below my composer.json file for reference:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.0"
},
"require-dev": {
"facade/ignition": "^2.3.6",
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.3",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.0|^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Best solution:
delete composer.lock file
Go to composer.json and add to "require" this: "laravel/breeze": "^1.1",
run composer install --ignore-platform-reqs
It's done
Your composer.lock file will generated again including installation
I need to install guzzlehttp/guzzle to work with stripe in laravel 5.8 app but I got
error with installing :
$ composer require guzzlehttp/guzzle
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Using version ^7.2 for guzzlehttp/guzzle
./composer.json has been updated
Loading composer repositories with package information
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for php-http/guzzle6-adapter (locked at v1.1.1, required as ^1.0) -> satisfiable by php-http/guzzle6-adapter[v1.1.1].
- Can only install one of: guzzlehttp/guzzle[7.2.0, 6.5.x-dev].
- Can only install one of: guzzlehttp/guzzle[7.3.x-dev, 6.5.x-dev].
- Conclusion: install guzzlehttp/guzzle 6.5.x-dev
- Installation request for guzzlehttp/guzzle ^7.2 -> satisfiable by guzzlehttp/guzzle[7.2.0, 7.3.x-dev].
My composer.json has :
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"clarification/sendgrid-laravel-driver": "^2.0",
"darkaonline/l5-swagger": "5.8.*",
"fideloper/proxy": "^4.0",
"jenssegers/agent": "^2.6",
"laravel/framework": "5.8.38",
"laravel/tinker": "^1.0",
"martinlindhe/laravel-vue-i18n-generator": "^0.1.46",
"paragonie/sodium_compat": "^1.14",
"php-http/guzzle6-adapter": "^1.0",
"guzzlehttp/guzzle": "^5.x",
"pusher/pusher-php-server": "^4.1.1",
"stripe/stripe-php": "^7.50",
"tintnaingwin/email-checker": "^2.0",
"spatie/browsershot": "^3.37",
"twilio/sdk": "^5.42"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"files": [
"app/library/helper.php"
],
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
I use PHP 7.4.15 .
How can it be fixed ?
Thanks!
You have to update the version of your guzzlehttp/guzzle becasue it is required by php version
Try to Change "guzzlehttp/guzzle": "^5.x" to this "guzzlehttp/guzzle": "^7.2.0" and then run composer update and your current php version is ^7.2
you can find more about it in here https://packagist.org/packages/guzzlehttp/guzzle#6.5.5
There is a conflict with the lastest version, use this instead
composer require guzzlehttp/guzzle:^7.0
I recently discovered a vulnerability in a package that I like to use in my Laravel projects. The package is a log viewer for Laravel: https://github.com/ARCANEDEV/LogViewer.
I put in an issue about the vulnerability and the owner said I can put in a Pull Request to try and rectify the issue, and I feel I could at least try.
My question is: is there a way to use the version of the package with my Pull Request in a testing environment, as if I were installing it via Composer?
Essentially, away from actual unit tests, is there a way to test run a package in a project?
Updates given research and available answers
After much Googling and reading of answers I tried the following:
Fork the repo I'm looking to make a pull request for. The fork is here: https://github.com/blorange2/LogViewer
Clone this forked repo onto my local machine and switch to the branch that's compatible with my current version of Laravel (which is v4.5 for Laravel 5.6)
Update the composer.json in my local project to have a repositories array
"repositories": [
{
"type": "path",
"url": "../forks/LogViewer"
}
],
With the whole thing looking like this:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "path",
"url": "../forks/LogViewer"
}
],
"require": {
"php": "^7.1.3",
"alexusmai/laravel-purifier": "^0.5.0",
"arcanedev/log-viewer": "^4.5",
"artesaos/laravel-linkedin": "^1.3",
"barryvdh/laravel-dompdf": "^0.8.4",
"cartalyst/tags": "6.0.*",
"cornford/googlmapper": "^2.33",
"doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"guzzlehttp/psr7": "^1.4",
"happyr/linkedin-api-client": "^1.0",
"intervention/image": "^2.5",
"ixudra/curl": "^6.16",
"jdavidbakr/mail-tracker": "~2.1",
"laravel/framework": "5.6.*",
"laravel/scout": "^5.0",
"laravel/socialite": "^3.0",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.6",
"laravolt/avatar": "^3.0",
"league/flysystem-sftp": "~1.0",
"maatwebsite/excel": "^3.1",
"maddhatter/laravel-fullcalendar": "^1.3",
"mews/purifier": "^2.1",
"php-http/curl-client": "^1.7",
"php-http/message": "^1.6",
"pusher/pusher-http-laravel": "^4.2",
"socialiteproviders/microsoft-graph": "^2.0",
"spatie/calendar-links": "^1.0",
"spatie/flysystem-dropbox": "^1.2",
"spatie/laravel-analytics": "^3.6",
"spatie/laravel-backup": "^5.9",
"spatie/laravel-medialibrary": "7.6.3",
"spatie/laravel-permission": "^2.12",
"teamtnt/laravel-scout-tntsearch-driver": "^3.0",
"thujohn/twitter": "^2.2",
"unisharp/laravel-filemanager": "~1.8",
"vimeo/laravel": "^5.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
},
"autoload": {
"files": [
"app/Helpers/Helper.php"
],
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
My main project is located at the following path (from running pwd on Windows) C:\xampp\htdocs\projects\newable\newable-intranet
The cloned, forked project is located here: C:\xampp\htdocs\projects\forks\LogViewer.
However, running composer update does not use the local version, it just uses: "arcanedev/log-viewer": "^4.5",
When you want to use a custom version of a library in your project like with the original package, you can modify the composer.json.
You can add custom package sources (aka repositories) to your composer.json for local development I prefer the path-repository:
{
"repositories": [
{
"type": "path",
"url": "../LogViewer"
}
],
"require": {
"arcanedev/log-viewer": "*",
...
},
...
}
So if your project and LogView-library are in the same workspace directory, side by side, this will jump up to that workspace-directory and go into the library folder. In there it will look for a composer.json. You should then be able to update to your custom library, e.g. using composer require arcanedev/log-viewer:"*" or by manually changing the entry as shown above and then runcomposer install`.
Making composer download the custom version can be a bit tricky from time to time, but in general this should work. If it won't "download" your version, i.e. symlink the local folder, try removing the existing vendor folder and running composer install again. You can also add debug output to composer install -vvv to see if the repository is found and used.
The less elaborate approach would be to remove the original library folder inside your project's vendor/ folder and instead place a symlink to your custom library manually. This is usually enough when all you do is a small bugfix inside the library's code, but when you change dependencies and version requirements I prefer the first approach as it basically simulates downloading the package through composer making sure it is properly usable in client projects.
I just cloned a repo with a Laravel 5.7 project, and I am having some troubles to run it on my machine.
When I make a composer install, I get this error:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover
In AuthServiceProvider.php line 35:
Class 'Laravel\Passport\Passport' not found
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
What can I do to solve this error? I dont know where to start.
This is the project's composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"designmynight/laravel-mongodb-passport": "^1.1",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"jenssegers/mongodb": "^3.4",
"laravel/framework": "5.7.*",
"laravel/passport": "^7.0",
"laravel/tinker": "^1.0"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Although composer update did the trick depending on situation it might not be the best solution.
First of all - when running composer install packages are installed based on versions that are in composer.lock if it's included in repository (it should be).
And in your case when you look carefully at console output you had:
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
So it's quite possible that someone added Laravel Passport package to composer.json but haven't run composer install or forgot to commit updated composer.lock file.
Now remember when running composer update you update all the packages. Sometimes it's fine (only on localhost) but sometimes it's not because not always you want to update all packages. So when you need to update single package you could try in this case also composer update laravel/passport just to force updating/installing just Laravel Passport without touching other packages.
It looks like you need to do
composer update
instead of install?