Since a few days i cant install composer-packages anymore in my local docker container.
I create new composer.json with composer init and try to add a package with composer require fzaninotto/faker
Always i get the same error message
# composer require fzaninotto/faker
Using version ^1.9 for fzaninotto/faker
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
Failed to download fzaninotto/faker from dist: The zip extension and unzip command are both missing, skipping.
Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
Now trying to download from source
- Installing fzaninotto/faker (v1.9.1): Cloning fc10d778e4 from cache
fc10d778e4b84d5bd315dad194661e091d307c6f is gone (history was rewritten?)
Installation failed, reverting ./composer.json to its original content.
[RuntimeException]
Failed to execute git checkout 'fc10d778e4b84d5bd315dad194661e091d307c6f' -- && git reset --hard 'fc10d778e4b84d5bd315dad194661e091d307c6f' --
fatal: failed to read object fc10d778e4b84d5bd315dad194661e091d307c6f: Operation not permitted
require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
First i guess my ssh key is the problem but i create a new one and add this to github with the same error.
Than i try it with composer clear and the problem don't resolved.
The problem come in EACH docker container and EACH composer packages... so i cant be a problem with single packages or container.
Have anyone an idea that i can do to use composer again?
If you're using Docker Desktop (Windows) and you updated to the latest version 2.2.0.4, then you get this issue.
Downgrade to the 2.2.0.3 and it should work again (at least it did for me).
See: https://forums.docker.com/t/issues-after-upgrading-docker-desktop-to-2-2-0-4/90589
To downgrade:
Uninstall Docker Desktop. Attention: it will delete your containers, save them before if you want to import them back
Go this page: https://docs.docker.com/docker-for-windows/release-notes/
Click Download under 2.2.0.3
Install Docker Desktop with the installer file
When started it will ask to upgrade to 2.2.0.4, just say "Skip this build"
I didn't have enough points to comment on the top answer but the Docker issue was just closed (like an hour ago!) and so simply updating Docker Desktop on Windows should fix it. Worked for me at least. Now I can install Drupal again!
Related
i am working on multiple composer packages and a application which dose requries all the packages that i develop.
I would like to know how i can have a package with multiple version
stable version for production
development / master version for local development
i tried following config but it din't work
{
"minimum-stability" : "dev",
"require" : {
"varunsridharan/vsp-framework" : "^1.0",
"wponion/wponion" : "^1.0"
},
"require-dev" : {
"varunsridharan/vsp-framework" : "dev-master",
"wponion/wponion" : "dev-development"
}
}
When i run composer install or composer install --no-dev i get the below output
Loading composer repositories with package information
Updating dependencies
[Composer\DependencyResolver\SolverProblemsException]
Problem 1
- The requested package varunsridharan/vsp-framework ^1.0 exists as varunsridharan/vsp-framework[dev-master] but these are rejected by your constraint.
Problem 2
- The requested package wponion/wponion ^1.0 exists as wponion/wponion[dev-development] but these are rejected by your constraint.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-author
itative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
Reason why composer has require and require-dev is to allow developers install packages that will allow them better debugging by using packages that are not suggested to be used in production. By adding a package on require-dev this package will not be required on production.
Ex. If you want to optimize you queries, see if you have any n+1 query problem etc you might want to install php-debugbar that will show you this info, but having this on production might expose your queries and will give sensitive info to bad guys.
Packages included on require will always be installed in development and in production and this is the reason you see the error The requested package xxxxx exists as xxxxx[dev-development] but these are rejected by your constraint.
To have different packages in DEV and PROD you need different composer.json files for each environment like #George said.
You can have one composer.json file that will be the production composer and one composer-dev.json that you can use for development.
On your local environment you will need to set value of COMPOSER env variable to composer-dev.json.
Simple way to do this is by running composer like this: COMPOSER=composer-other.json php composer.phar install
If you want to require a new packages you need to run the command twice, one time normally and one time by adding COMPOSER=composer-other.json before composer, to ensure that the package will be added both in dev and production.
P.S I do not know the reason why you need different packages for development and production, but it is suggested to have the same version of packages in dev and prod as having different versions might bring up bugs
You can try changing composer.json file in your dev environment. See Composer
COMPOSER=composer-dev.json php composer install
Reference Composer - specify `composer.json` path
I am new at laravel (just installed laravel!).
I have searched many websites and tested any solution I found but none of them works for me. I have installed laravel in my localhost (Ex: localhost/laravel);
I have a laravel website source that contains files & folders in below:
floders:
-admin
-assets
-components
-dist
-src
files:
- .htaccess
- 404.php
- etc etc ...
- package.json
- package-lock.json
- and other php files
in some solutions they says that I must run two simple code:
composer install
php artisan:migrate
but I have no idea where and how to do that when I haven't any composer file in my source. I tested package.json install but it shows me errors.
I need help about this project. it is not in laravel directory just another directory in www folder like (localhost/test).
What should I do to import this source to laravel and run it?
UPDATE 1
After searching in Laravel Docs I found this line of code:
composer require laravel/homestead --dev
But when I run this on my project directory I see this error:
[InvalidArgumentException]
Could not find a matching version of package laravel/triplee. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
Since you are new at laravel, I suggest you to use vagrant for this. You can find lots of videos about installation of laravel with vagrant:
https://www.youtube.com/results?search_query=laravel+vagrant
Besides it's comfortable usage, it also provides great advantages.
Now I remember why I never got into PHP. It's such a pain to set up. I spent a couple hours today trying to complete a coding challenge which required me to install Composer, Vagrant, VirtualBox and Laravel.
Somewhere along the line I think my permissions or something changed, because whenever I try to install Laravel...
composer global require "laravel/installer"
I get...
Changed current directory to /home/dilraj/.composer
[ErrorException]
file_put_contents(./composer.json): failed to open stream: Permission denied
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
I am not sure why I am getting this, perhaps it is because I have already done it, but regardless, when I try to create an executable command I am not seeing any results.
I edited the .bashrc file, as such...
export PATH="$PATH:$HOME/.config/composer/vendor/bin
source ~/.bashrc
I am not going to lie, I don't what this is even doing. I just want to make it so I can type 'laravel' and then start doing stuff, kinda like in npm.
Here are other things I tried but succeeded without any luck :(
export PATH="$PATH:$HOME/.composer/vendor/bin"
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
alias laravel='~/.config/composer/vendor/bin/laravel'
You don't you address the issue noted in the error, primarly Permission denied. Running chmod 755 .composer should be enough to give you permission to edit the file.
If that doesn't work, add sudo in front of it to update it using root account.
seems like you have install composer as root.
You can try to install laravel without Laravel Installer by run :
composer create-project --prefer-dist laravel/laravel projectfolder
It its not working, try using sudo command :
sudo composer create-project --prefer-dist laravel/laravel projectfolder
I am trying to run the command composer install from the command line and every time I do so I generate the following error:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","me
ssage":"main(): Failed opening required '..\/app\/controllers\/UsersController.p
hp' (include_path='C:\\xampp\\htdocs\\project\\html\\vendor\/phpseclib\/phpsecli
b\/phpseclib;.;C:\\xampp\\php\\PEAR')","file":"C:\\xampp\\htdocs\\project\\html\
\app\\filters.php","line":2}}Script php artisan clear-compiled handling the post
-install-cmd event returned with an error
[RuntimeException]
Error Output:
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-p
lugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress
] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [pac
kages1] ... [packagesN]
I also get the exact same error when running:
composer update
I am on Windows 8, using XAMPP, the PHP version is 5.5, and I am using Laravel 4. It is also worth noting that I copied this project from a Git repository and not create a project from scratch.
And I get the following response when trying to run the command php composer.phar update
Could not open input file: composer.phar
Thank you in advance! I am new to Laravel so feel free to spell things out for me, I might need it.
I am using Symfony 2.3.4
On my console i did composer create-project sylius/sylius --prefer-dist
Everything downloaded smoothly until it came to installing sensio/distribution-bundle
Composer throw out this error message
[Composer\Downloader\TransportException]
The "https://api.github.com/repos/sensio/SensioDistributionBundle/zipball/4
a2c803dc8db79952ad5e71783c16178427bbc02" file could not be downloaded (HTTP
/1.1 404 Not Found)
create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repos
itory-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--n
o-scripts] [--no-progress] [--keep-vcs] [package] [directory] [version]
I tried :
Editing sylius/composer.json and modify "sensio/distribution-bundle": "2.3." to "sensio/distribution-bundle": "2.2.-dev"
Open a shell in C:\wamp\www\sylius. Rename app/config/parameters.yml.dist to parameters.yml, run php composer.phar update --prefer-dist, still having lots of errors about MongoDb
Is there any other way to install sylius?
How can i fix this?
Thanks heaps
It seems that sylius build in 0.1.0 is broken. If you want functional sylius installation you have to use dev-master version.
composer create-project sylius/sylius sylius dev-master
They fixed the issue! The problem was indeed with the Sylius build. Today i created a freshly installed Symfony2 onto my server, and did composer composer create-project sylius/sylius --prefer-dist
Sensio/SensioDistributionBundle installed correctly.
Steps to installed Sylius
1. composer create-project sylius/sylius --prefer-dist (this method download compressed file when available) or composer create-project -s dev sylius/sylius
make sure to enable php_info extension
create a database in php myadmin
cd sylius and then php app/console sylius:install
The last part of the installation will asked you for some parameters, the default option given works fine. Accustomed it to your config
I spend 48 hours trying to install sylius finally things got better now.
There is many issues with Sylius at the moment. Check Out And is really slow. I am still finding a way to speed things up. I took like 3 minutes to load when i clicked on Register.
If you got issued like MongDB not found, or any bundle not found, then surely there is a problem with the way you are trying to install Sylius. And Please at the moment do not cd sylius and composer update, it won't worked. I got told that they rearranged the bundle.
You can find more detailed Click here!
Please feel free to edit this post if you feel that there is something that i haven't talked about for sylius installation.
Thanks to Sylius Contributors!