composer global require fails where non global equivalent succeeds - php

Im developing a package available at packagist as user/package. Installing it locally works just fine
composer require user/package
Creating a new project is also fine
composer create-project --prefer-dist user/package new-project
But the package is to be deployed globally
composer global require user/package
however this results in the following error log.
Changed current directory to /home/anders/.composer ./composer.json
has been updated Loading composer repositories with package
information Updating dependencies (including require-dev) Your
requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for user/package ^v0.0.3 -> satisfiable by user/package[v0.0.3].
- Conclusion: remove illuminate/container v5.5.2
- Conclusion: don't install illuminate/container v5.5.2
- don't install tightenco/collect v5.4.33|don't install laravel/framework v5.5.2
- don't install laravel/framework v5.5.2|remove tightenco/collect v5.4.33
- Installation request for illuminate/container (installed at v5.5.2) -> satisfiable by illuminate/container[v5.5.2],
laravel/framework[v5.5.2].
- Installation request for tightenco/collect (installed at v5.4.33) -> satisfiable by tightenco/collect[v5.4.33].
Installation failed, reverting ./composer.json to its original
content.
How can this be?
I have tried composer global clearcache
Deleted a composer.lock file I found directly under /home/anders/.composer/
Upgraded my dependencies (Laravel) from 5.5.x to 5.6.x with no effect
Even creating a fresh "laravel new blog" project and uploading to packagist fails with the same error message.
Here is my composer.json
{
"name": "user/package",
"description": "Package",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"ajthinking/tinx": "^2.1",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.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
},
"bin": [
"package"
]
}
Would really appreciate help interpreting the error log. Thanks!
Update
This is the content of /home/anders/.composer/
{
"require": {
"cpriego/valet-linux": "^2.0",
"laravel/installer": "^1.4",
"phpunit/phpunit": "^6.4",
"phpunit/dbunit": "^3.0"
}
}
Composer version: 1.6.5

If this is standalone tool, you should consider building PHAR for it. You can use kherge/box to simplify build process.
PHAR archive is completely standalone, so you'll get rid of all problems with conflicting global dependencies. It may also simplify installation (you need to just download archive and make it executable) for both global and local installation.

Related

Issue installing laravel-doctrine/migrations package in laravel 9

I am trying to install the migrations on a fresh install of laravel 9, however I am getting this error
Problem 1
Root composer.json requires laravel-doctrine/migrations ^2.3 -> satisfiable by laravel-doctrine/migrations[2.3.0, 2.3.1, 2.x-dev].
laravel-doctrine/migrations[2.3.0, ..., 2.x-dev] require illuminate/config ^6.0|^7.0|^8.0 -> found illuminate/config[v6.0.0,
..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these
were not loaded, likely because it conflicts with another require.
You can also try re-running composer require with an explicit version
constraint, e.g. "composer require laravel-doctrine/migrations:*" to
figure out if any version is installable, or "composer require
laravel-doctrine/migrations:^2.1" if you know which you need.
previously I installed the orm with this command
composer require laravel-doctrine/orm
I have tried to install other versions but the message is the same
composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel-doctrine/orm": "^1.8",
"laravel-doctrine/migrations":"^2.3",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-update-cmd": [
"#php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
UPDATE
I am trying to install the package with laravel 8 however I have this error when executing the command for version ~1.7
command
composer require laravel-doctrine/orm doctrine/inflector:"^1.4|^2.0"
Error
Problem 1
- laravel-doctrine/orm[1.8.0, ..., 1.8.x-dev] require illuminate/support ^9.0 -> found illuminate/support[v9.0.0-beta.1,
..., 9.x-dev] but these were not loaded, likely because it conflicts
with another require.
- Root composer.json requires laravel-doctrine/orm ^1.8 -> satisfiable by laravel-doctrine/orm[1.8.0, 1.8.1, 1.8.x-dev].
You can also try re-running composer require with an explicit version
constraint, e.g. "composer require laravel-doctrine/orm:*" to figure
out if any version is installable, or "composer require
laravel-doctrine/orm:^2.1" if you know which you need.
doctrine-migrations does not support laravel 9 at yet. See this discussion
It will be supported after it upgrade to doctrine/migrations 3 in this Pull Request
So if you want to really install doctrine/migrations, you need to use Laravel 8 instead of laravel 9.
Otherwise, you need to wait untill that PR merged and released
SOLVED
Currently doctrine/migrations can be installed using this command
composer require laravel-doctrine/orm "^1.7" doctrine/inflector:"^1.4|^2.0"
after install the packages you can install migations with no problems
Note that version 1.7 must be specified in the command, since it does not appear explicitly in the documentation

Laravel 8 Your requirements could not be resolved to an installable set of packages when running composer require laravel/passport

There are a lot of versions of this question floating around, but i haven't found any that deal with these specific packages.
I am trying to install laravel passport version 10 into my laravel 8 installation,
When running composer require laravel/passport i get the following response:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/passport[v10.0.1, ..., 10.x-dev] require illuminate/auth ^8.2 -> found illuminate/auth[v8.2.0, ..., 8.x-dev] but it conflicts with another require.
- laravel/passport v10.0.0 requires illuminate/auth ^8.0 -> found illuminate/auth[v8.0.0, ..., 8.x-dev] but it conflicts with another require.
- Root composer.json requires laravel/passport ^10.0 -> satisfiable by laravel/passport[v10.0.0, v10.0.1, 10.x-dev].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
found illuminate/auth ^8.0 -> found illuminate/auth[v8.0.0, ..., 8.x-dev] <- I dont understand this part, does it have anything to do with having "minimum-stability": "dev" in my composer.json?
Anyways, here is my composer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4.1",
"fruitcake/laravel-cors": "^2.0.3",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^9.0",
"laravel/passport": "^10.0",
"laravel/tinker": "^2.5|dev-develop",
"paragonie/random_compat": "2.*"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.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"
]
}
}
EDIT 1:
I tried running composer require --no-update laravel/passport and when i run composer update I get the following error(i though it may provide extra info):
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/passport[v10.0.1, ..., 10.x-dev] require illuminate/support ^8.2 -> satisfiable by illuminate/support[v8.2.0, ..., 8.x-dev].
- laravel/passport v10.0.0 requires illuminate/support ^8.0 -> satisfiable by illuminate/support[v8.0.0, ..., 8.x-dev].
- Only one of these can be installed: illuminate/support[dev-master, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev], laravel/framework[dev-master]. laravel/framework replaces illuminate/support and thus
cannot coexist with it.
- laravel/framework 9.x-dev is an alias of laravel/framework dev-master and thus requires it to be installed too.
- Root composer.json requires laravel/framework ^9.0 -> satisfiable by laravel/framework[9.x-dev (alias of dev-master)].
- Root composer.json requires laravel/passport ^10.0 -> satisfiable by laravel/passport[v10.0.0, v10.0.1, 10.x-dev].
EDIT 2:
To further explain the answer below, you have to delete the vendor folder and composer.json file inside your project, the you run composer install to downgrade to laravel 8.
After that you can run composer require laravel/passport and it will install properly
Just simple do one thing
remove composer.lock file and then install your required package
It work for me...
Downgrade your Laravel version from 9 to 8
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4.1",
"fruitcake/laravel-cors": "^2.0.3",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/passport": "^10.0",
"laravel/tinker": "^2.5|dev-develop",
"paragonie/random_compat": "2.*"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.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"
]
}
}
I was able to solve this problem just by modifying the PHP PATH on my operating system, at the time I am using windows with WampServer.
The change suggested above may work, but if a composer install command is being run, it is because an App already exists and is just downloading its dependencies, so changing the file suggested above can cause problems in the operation of the Application.
I think that changing the PATH note to the correct PHP version will work, in my case:
C:\wamp64\bin\php\php7.3.21 worked.
Valew.
I vas trying to install barryvdh/laravel-ide-helper when I got this error. It required PHP 7.3+ and Laravel 8.0+ as described here, but I had lower versions. So here are the steps I followed:
Deleted composer.lock file
Changed the version of PHP and Laravel in composer.json
Ran composer install which creates a new composer.lock file
Then ran composer require barryvdh/laravel-ide-helper and it was installed successfully
Just delete composer.json and composer.lock files, and it will do the trick :)

Your requirements could not be resolved to an installable set of packages in laravel 5.7

Unable to install package from laravel 5.7
Using version ^0.8.4 for barryvdh/laravel-dompdf ./composer.json has been updated
Loading composer repositories with package information Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravel/passport == 7.2.1.0
-> satisfiable > by laravel/passport[v7.2.1].
- avored/ecommerce 2.0 requires laravel/passport 5.0.*
-> satisfiable by laravel/passport[5.0.x-dev].
- avored/ecommerce 2.0.1 requires laravel/passport 5.0.*
-> satisfiable by laravel/passport[5.0.x-dev].
- Conclusion: don't install laravel/passport 5.0.x-dev
- Installation request for avored/ecommerce 2.*
-> satisfiable by > avored/ecommerce[2.0, 2.0.1].
Installation failed, reverting ./composer.json to its original content.
My composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"avored/ecommerce": "2.*",
"avored/module-installer": "1.*",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*",
"laravel/passport": "^7.2",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.7",
"unisharp/laravel-filemanager": "^1.8"
},
"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",
"laravel/dusk": "^4.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
}
Delete to this in your composer.json file:
"require": {
"avored/ecommerce": "2.*",
}
Then update composer: composer update
This package(avored/ecommerce) is not compatible with Laravel 5.7
For testing purpose I have try this command(composer require avored/ecommerce) in Laravel 5.5, 5.6 and 5.7
It's worked only Laravel5.5, other 5.6 and 5.7 I also got the same error as yours.
There is a dependency conflict specified on the composer.json file, you are stating that you want "laravel/passport": "^7.2" or later, but as you can seee on the avored composer file it requieres laravel/passport 5.0 so downgrade your dependency requirement.
Also I'm pretty sure passport 5.x is compatible with Laravel 5.6 so you need to downgrade laravel to ^5.6 as well.
Change:
"laravel/framework": "5.7.*",
"laravel/passport": "^7.2",
with:
"laravel/framework": "5.6.*",
"laravel/passport": "^5.0",
And then execute composer update

i can not install laravel passport

composer require laravel/passport ^v1
result command
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
- Installation request for doctrine/instantiator (installed at 1.1.0) -> satisfiable by doctrine/instantiator[1.1.0].
Installation failed, reverting ./composer.json to its original content.
my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.22",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"laravel/passport": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
how can i solved it
Install php 7.1 and you will be fine.
For ubuntu
https://www.vultr.com/docs/how-to-install-and-configure-php-70-or-php-71-on-ubuntu-16-04
For windows
http://php.net/manual/en/install.windows.php
You have to update your php version to be 7, after that you have to re install your composer and make sure that it will take correct php version

composer require laravelcollective html 'doesnt download dependancy

Please see when When I run composer install please assist,
I am new to laravel and I cannot download dependency for laravelcollective/html ... I am using laravel 5.5.13
I want to require laravelcollective/html
however I face the following problems.
when I run : composer require "laravelcollective/html:5.2.*",
I get the below mentioned(similarly when I run composer update ) :
C:\Users\MALULEKE\Desktop\lara_proj\shops>composer require "laravelcollective/html:5.2.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package laravelcollective/html could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
C:\Users\MALULEKE\Desktop\lara_proj\shops>composer require "laravelcollective/html:5.2.*"
below is my composer.json relative to my project's work (not from composer/roaming, I am not even sure which is it I must use, please help )
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*#dev",
"laravel/tinker": "~1.0",
"laravelcollective/html":"~5.3.#dev"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.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
}
}
Try running composer require laravelcollective/html which will install the latest version of LaravelCollective packages for you.
I have decided to use AngularJS as my front end.
Note that this solution may not be suitable for everyone, and with this solution, problems may arrive in future, due to the need for other composer requirements, such as authentication dependencies that my be needed.

Categories