Laravel installation problem (by using composer on windows) - laravel

I am trying to install laravel on windows by using composer, and got this error:
"[Composer\Downloader\TransportException]
curl error 7 while downloading https://repo.packagist.org/p2/laravel/laravel.json: Failed to connect to 127.0.0.1 port 9999: Connection refused"

You could also run this command on the CLI before installing any dependencies. It forces the composer to use HTTPS to download all resources:
composer config -g repo.packagist composer https://packagist.org
Or if your problem is not resolved:
The issue could be caused by the redirect from http to https. (or your firewall blocking the call)
According to this article, the problem could be solved by adding the following to your composer.json:
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
FMI: http://codinginharmony.blogspot.com/2012/10/forcing-composer-to-use-https.html#comment-form

Related

Composer can't access local Satis server

I am hosting a Satis Private Repository currently on my local machine while I do some debugging and testing. I have added a repository too which currently just contains a project on GitLab which included a composer package.
Currently it is being pulled from a docker image, and is hosted at localhost:8002.
My repository is setup in my Laravel project as follows:
"repositories": [
{ "packagist": false },
{
"type": "composer",
"url": "http://localhost:8002/packages.json"
}],
And if I navigate to that URL in my browser I get the following output:
{
"packages": [],
"includes": {
"include/all$949e06d91b8be4b54109a0b06c31805a5735a1ba.json": {
"sha1": "949e06d91b8be4b54109a0b06c31805a5735a1ba"
}
}
}
However, if I try to composer update the Laravel project, I get the following errors depending on if I execute it from within the container.
The "http://localhost:8002/packages.json" file could not be downloaded (HTTP/1.1 504 Gateway Timeout)
[Composer\Downloader\TransportException]
The "http://localhost:8002/packages.json" file could not be downloaded: failed to open stream: Address not available
If anyone would be able to point me in the right direction at all I would really appreciate it, as I am scratching my head here.

Configure composer to get data from packagist.org via https

When building files in an environment that blocks outbound http requests, I get an error like:
Updating dependencies (including require-dev)
The "http://packagist.org/p/provider-2013%ahash.json" file could not be downloaded: failed to open stream: Connection timed out
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Is there some way to instruct composer to use https connection to packagist?
I've experienced the issue with both 1.2.0 and 1.6.5 versions of composer.
You can either force composer to use https by:
composer config -g repo.packagist composer https://packagist.org
Or you could set in your composer.json file:
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
Source: issue #5656 on composer's github repository.

Composer clones from cache instead of repo

I have two projects I am working on, both were setup as git repos, both use composer.
First project uses second as a library.
I configured composer.json in the following way:
... "repositories": [
{"type": "composer", "url":"http://composer.myrepourl.com/repo/private/"},
]
"require": {
"second/second": "dev-B-3"
} ...
There was no problem pulling the project from a repository for the first time. However now I made some changes in second project, pushed to the repo and now want to have them in first project, but for some reason composer pulls from the cache.
I ran composer clear-cache. I tried deleting: vendor folder, /home/user/.composer/cache, cache inside container /root/.composer/, but it still finds a way to clone the second project from cache instead of pulling it from repo.
Any ideas on how to force composer to always pull from repo instead of cloning from cache?
Run
$ composer install --prefer-source
Alternatively, specify your preferred installation method in composer.json generally:
{
"config": {
"preferred-install": "source"
}
}
or specifically for the desired dependency
generally:
{
"config": {
"preferred-install": {
"vendor/package": "source",
"*": "dist"
}
}
}
For reference, see:
https://getcomposer.org/doc/03-cli.md#install
https://getcomposer.org/doc/06-config.md#preferred-install
you should run
composer clear-cache
then
composer update --prefer-source
Ok I have found a solution:
sudo rm -r /home/user/project/vendor
cd %wherever_your_docker_is%
docker-compose stop
docker-compose rm
docker-compose up -d
composer update

Composer fails executing app/console cache:clear on symfony 3

I cant run composer install because it fails when executing the post-install-cmd-scripts.
The reason is Symfony 3 moved the console app from the app folder to a bin folder.
I have tried composer clear-cache and composer self-update, so I can verify that I'm running the latest version of composer without any luck... Can anyone help me?
Results from composer diagnose
composer diagnose
Checking composer.json: FAIL
Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance
require.symfony/symfony : unbound version constraints (dev-master) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK
Edit:
Added my composer.json file: Pastie
Extra's part:
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
}
}
Error from Composer:
Could not open input file: app/console
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Could not open input file: app/console
.
Manuall test of bin/composer cache:clear:
bin/console cache:clear
// Clearing the cache for the dev environment with debug true
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
The problem repo: https://bitbucket.org/Richardh87/messenger
Had the same problem. Found that var directory was missing.
Adding var directory to project root dir solved this for me. It looks like symfony 3 tries to use old project structure if var folder is missing. Hope this can help someone.
try
sudo rm -rf vendor/*
sudo rm -rf composer.lock
then run
composer install
again
Check the extra config key in the composer.json files names as symfony-bin-dir.
So check that the composer contain the correct configuration key, as example:
composer.json
....
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
....
Changing the gitignore worked for me, like this:
# Cache and logs (Symfony3)
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
!var/logs/.gitkeep
# Parameters
/app/config/parameters.yml
/app/config/parameters.ini
# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/
# Assets and user uploads
/web/bundles/
/web/uploads/
# Assets managed by Bower
/web/assets/vendor/
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data
/build/
# Composer PHAR
/composer.phar

Downloading: connection...Failed to download cartalyst/nested-sets from dist:

I'm having some problems with a package (cartalyst/nested-sets) on my local laravel application. My composer.json is valid as:
$ composer validate
./composer.json is valid
I have a copy of the nested-sets package files on my desktop and have included them in my project tree - so the files are present and paths are correct.
Here's a snapshot of my composer.json file:
"require": {
"cartalyst/nested-sets": "2.0.*"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.cartalyst.com"
}
],
...
I then issue:
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing cartalyst/nested-sets (v2.0.2)
Downloading: connection...Failed to download cartalyst/nested-sets from dist: The "https://api.github.com/repos/cartalyst/nested-sets/zipball/7a425710ece922556e55150f5a1f2dfbedd4ffaa" file could not be downloaded (HTTP/1.1 404 Not Found)
Now trying to download from source
- Installing cartalyst/nested-sets (v2.0.2)
Cloning 7a425710ece922556e55150f5a1f2dfbedd4ffaa
It then just hangs with a blinking cursor at the shell. PHP OpenSSL extension is installed on my local and switching the firewall off makes no difference.
From the shell:
Failed to download cartalyst/nested-sets from dist: file could not be downloaded (HTTP/1.1 404 Not Found) but the files are already there? I don't understand.
You encounter this problem because you have to subscribe to Cartalyst repositories so you can get full access of their ressources and products ( libraries , components , sources ).
When Composer is trying to fetch Cartalyst from donwload or accessing a repository , it will ask you a valid username / password , if you have paid for a subscription you will get a valid auth credentials that enable you to access the repository and donwload via composer the required component / library ...
please read the following : https://medium.com/#Cartalyst/boss-sheet-8019c5e07246

Resources