Composer Magento 2 - can't install dev-master - composer-php

I want to run composer install and use modules with stability flag dev-master.
But composer won't install them.
What can I do to install these modules?
I use this command:
composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader
The result is that only modules with a version will be installed like:
"require": {
"magento/product-community-edition": "2.1.7",
"composer/composer": "#alpha",
"company/magento2-mymodule-name": "dev-master",
"company/magento2-mytheme-name": "dev-master",

Do you have already file composer.lock created? If so, try running composer update.

Related

Composer install VS composer install --dev

Is there any differences between "composer install" and "composer install --dev"?
I ran these two commands and get the same packages installed.
As you can read in the documentation, leaving it out and using --dev performs the same action:
--dev: Install packages listed in require-dev (this is the default behavior).

Auth is not creating in laravel 8

i use this command
composer require laravel/ui
to make auth in laravel:8 but it gives the following error:
Using version ^3.3 for laravel/ui
./composer.json has been updated
Running composer update laravel/ui
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/ui[v3.3.0, ..., 3.x-dev] require illuminate/console ^8.42 -> found
illuminate/console[v8.42.0, ..., 8.x-dev] but these were not loaded, likely because it
conflicts with another require.
- Root composer.json requires laravel/ui ^3.3 -> satisfiable by laravel/ui[v3.3.0, 3.x-dev].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
First of all you should update all your packages of php using this command:
composer update
after this try with the install of laravel/ui:
composer require laravel/ui
execute one of them :
// Generate login / registration scaffolding...
php artisan ui bootstrap --auth
php artisan ui vue --auth
php artisan ui react --auth
finally
npm install
You can Update manually composer.json file
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.0",
Then run composer update Command

Can I solve "Your requirements could not be resolved to an installable set of packages." in laravel composer

when I want to install laravel/ui the composer show this:
and my composer.json :
my laravel version is 6.13 and I went to laravel.com and I click the Authentication for laravel 6X and says for laravel 6 you have to install this package and the package is composer require laravel/ui "^1.0" --dev and composer show me that problem again what can I do?
Add this in composer.json and then use command composer update
"laravel/ui": "^1.2",
Sometimes the library which you're installing is not satisfied PHP version not only laravel version.

Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found when I make composer install --optimize-autoloader --no-dev

I'm deploying my Laravel application and want to optimize the autoload, normally I would run the command
composer install --optimize-autoloader --no-dev
This is an application that runs Laravel 5.8. I am getting the following error:
In Application.php line 662:
Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found
Script #php artisan package:discover --ansi handling the
post-autoload-dump event returned with error code 1
If you do not have development dependencies on the laravel-dump-server, remove the following line from composer.json.
"beyondcode/laravel-dump-server": "^1.0".
Then run the following command.
composer install
Or, even easier, just run the following.
composer remove --dev beyondcode/laravel-dump-server
In my case I have done below steps
Delete vendor folder
Run: composer self-update --1
And again run: composer install
Then you can run any command you want
A detail around this issue has been written in one of the GitLab issues on
https://github.com/GoogleCloudPlatform/php-docs-samples/issues/736
This issue explain why this dev package creates problem on your build server.
For me, The issue resolved after I've added this in composer.json
{
"scripts": {
"gcp-build": [
"composer install --no-dev"
]
}
}
This will remove all the dev dependencies
I simply do
composer update
and then I redo again
like myself I run
php artisan migrate
Solution 1
composer install --optimize-autoloader --no-dev
if this not work try and getting error undefine index: Name
Solution 2
Step1: `composer self-update --1`
Step2: composer install
Bingo...!!!
You may need to run composer update with the --no-plugins option.
composer update --no-plugins

How can I resolve "Your requirements could not be resolved to an installable set of packages" error?

When I run composer update I receive some wired output.
Here is my composer.json look like.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.", "keywords": ["framework", "laravel"],
"license": "MIT",
"repositories": [{
"type": "vcs",
"url": "https://github.com/Zizaco/ardent.git"
}],
"require-dev": {
"phpunit/phpunit": "4.3.*"
},
"require": {
"laravel/framework": "4.2.*",
"laravelbook/ardent": "dev-master as 2.4.0",
"zizaco/entrust": "dev-master",
"sebklaus/profiler": "dev-master",
"doctrine/dbal": "dev-master"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations", "app/database/seeds", "app/tests",
"app/libraries"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
How do I fix that ?
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Composer ignore-platform-reqs flag explanation
Your software dependencies have an incompatible version conflict.
At the same time you want to install any Laravel 4.2.x version, and "zizaco/entrust" from its master branch. And that master branch requires at least Laravel 5.0 (roughly speaking).
The problem comes from the dependency on branches. It's likely that the package zizaco/entrust once was using Laravel 4.2 in its master branch, and that you were able to install your dependencies at that day. But the very moment this branch gets updated with an incompatible version requirement, you will never ever be able to run composer update and get updated dependencies.
Always use tagged versions! Ideally you use a relaxed version requirement that allows for compatible updates. This should be expressed as a tilde-two-number version requirement: ~1.2 would install a version 1.2.0 and up (like 1.2.99 or 1.2.100), and also 1.3 and up. If you need a certain patch release: Caret-three-number version ^1.2.10 will install 1.2.10 or up, also 1.3 and up.
Using this version requirement instead of dev-master will allow you to use released versions instead of the unstable state in the master branch, and allows you to address the most recent version that still works with Laravel 4.2. I guess that would be zizaco/entrust version 1.3.0, but version 1.2 would also qualify. Go with "zizaco/entrust": "~1.2".
I am facing the same issue. I am using 'Lumen' microservice framework.
I recently resolved the same issue by installing two packages:-
sudo apt-get install php7.0-mbstring,
sudo apt-get install php7.0-xml or sudo apt-get install php-xml
After installing this, you need to execute this command:-
composer update
Hope, it will resolve the issue. I work on my system.
The simplest solution is adding --ignore-platform-reqs flag.
If you are running composer install or composer update use it with --ignore-platform-reqs flag
Example
composer install --ignore-platform-reqs
Or
composer update --ignore-platform-reqs
And this should do the trick!
I use Windows 10 machine working with PHP 8 and Lavarel 8 and I got the same error, I used the following command :-
composer update --ignore-platform-reqs
to update all the packages regardless of the version conflicts.
Were those dev-masters added automatically? Avoid them as unnecessary version constraints, for 'any suitable version' use "*", or "#dev" if you don't mind dev packages. My guess is that Entrust is the potential troublemaker.
Also, "minimum-stability": "stable" imposes additional constraints, and
"minimum-stability": "dev",
"prefer-stable": true
is more conflict-free, consider it a rule of thumb.
I solved the same issue setting 'laravel/framework' dependency version from "^8.0" to "^7.0".
After that running composer update --ignore-platform-reqs simply worked
composer.json
I am facing the same issue in Laravel v8.49.0 (PHP v8.0.6). Using Composer through install packages
I recently resolved the same issue by installing two packages:-
composer create-project laravel/laravel myapp
Composer Update
composer update --ignore-platform-reqs
OR
composer install --ignore-platform-reqs
Check Start Server
php artisan serve
You must be in the correct directory so cd into it, then:
composer update --ignore-platform-reqs if you have previous installed composer as Vivek M suggests. My problem was wrong directory.
cd into: xampp/htdocs/laravelProjects/laravelP1
Add "barryvdh/laravel-cors": "^0.7.3" at the end of require array inside composer.json
Save composer.json and run composer update
You are done !
I solved the same error, by adding "zizaco/entrust": "*" instead of the "zizaco/entrust": "~1.2".
Install the following according to the PHP version installed on your system:
sudo apt-get install php8.0-curl php8.0-gd php8.0-xsl php8.0-dom
Finally try again to create the laravel project with composer
composer create-project laravel/laravel myProject
I encountered this problem in Laravel 5.8, what I did was to do composer require for each library and all where installed correctly.
Like so:
instead of adding it to the composer.json file or specifying a version:
composer require msurguy/honeypot: dev-master
I instead did without specifying any version:
composer require msurguy/honeypot
I hope it helps, thanks
"config": {
"platform": {
"ext-pcntl": "7.2",
"ext-posix": "7.2"
}
}
If you are using php ^8.0
open list of available php versions
sudo update-alternatives --config php
switch to on of the older versions above PHP 7.2, select one of them
then update composer
composer update
CAUSE:
The error is happening because your project folder is owned by the root user.
SOLUTION
Change ownership to the currently signed in user and not the root user. If you only have root as the sole user, create another user with root privileges.
$ sudo chown -R current_user /my/project/directory/
then
$ composer install
Just activate the curl in the php.ini file
;extension=php_curl.dll
to
extension=php_curl.dll
and then composer install

Resources