composer create-project not installing Laravel 5.3 - php

I have been trying to no avail to install Laravel 5.3 but keep getting 5.2 installed. Here's what i have done.
composer create-project laravel/laravel laravel53
This should pull in the latest version of laravel which is 5.3 right? Well, i thought so but i keep getting 5.2 installed
Then i felt it may be a problem with composer so i ran composer self-update
composer self-update
And still get 5.2 installed when i run create-project
I'm pretty sure i am getting something wrong because i ran this same command on a friend's laptop and 5.3 got installed
I am using a mac book pro BTW
Any ideas why this is so and how it can be solved?
Much thanks

I found out that the problem has been my php version all along. The version I had was 5.5 and laravel 5.3 requires php version 5.6 or higher.
For anyone having this issue, first thing you might want to do is to check your php version and upgrade to 5.6 or higher. This one line installation worked for me
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
Depending on the version you want and the OS specs, check this resource out http://php-osx.liip.ch/ it was very helpful for me.
so to install laravel5.3, you could use composer create-project:
composer create-project laravel/laravel projectName
or
composer create-project laravel/laravel=5.3.0 projectName --prefer-dist
Thanks and good luck!

First of all try to clear the composer cache:
composer clear-cache
Then try with this command:
composer create-project laravel/laravel=5.3.4 laravel53 --prefer-dist
Alternatively, open the composer.json file and change this:
"require": {
"laravel/framework": "5.2.*"
},
to:
"require": {
"laravel/framework": "5.3.*"
},
and then composer update

I just tried with php 5.6.3 and failed,
make sure your php version is >= 5.6.4

I already had PHP 5.6 but it was not able to write .env file so I was required to run the command using sudo.

Related

How to downgrade or install a specific version of Composer?

I'm getting the following error in a project I'm setting up:
You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.
I've started at a new company this week, just trying to get their projects installed and there doesn't seem to be a way to change my composer version on Windows. I'd rather not update all their packages as I'm not familiar with the projects yet and have no clue what kind of implications go into that.
Assuming a regular composer installation, to rollback to version 1 of composer, you simply execute:
composer self-update --1
When you want to go back to version 2 (which you should, after updating or removing the incompatible plugins):
composer self-update --2
The above will take you to the latest on any of the two major versions.
You can also "update" to a specific version just by passing the version number to self-update:
composer self-update 1.10.12
composer self-update 2.0.7
After performing any self-update, you can specify --rollback to go back to the previously installed version.
composer self-update
composer self-update --rollback
Finally, if you are feeling adventurous, you can update to a pre-release version by executing:
composer self-update --preview
If you have already installed composer on your system. then paste the below code to downgrade the composer version with a specific version as per your need.
composer self-update 1.10.14
for ubuntu system use the below command
sudo -H composer self-update 1.10.14
Just two commands worked for me. Currently I have composer 2.x.x , I had 1.10.x . First one command will download downgrade version and then second command will rollback to 1.x.x
php composer self-update --1
composer self-update --rollback
I found a flag in composer installer "--1" and "--2".
I'm using this command inside of my Dockerfile:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --1
You can use following code for update to specific versions
composer self-update 1.10.12
composer self-update 2.0.7
or
composer self-update --1 or 2
The below command is used to update the specific version of the composer.
composer self-update [version no of composer]
Use phar instead.
Download specific version of composer.phar file from :
https://getcomposer.org/download
Place this phar file in your project root directory where you are trying to run composer install/update/require
now instead of composer require use php composer.phar require

Cant install Laravel 6

I want to install Laravel 6 with Composer. I try with that command:
composer create-project --prefer-dist laravel/laravel laravel6 "6.*"
But i get that result:
[InvalidArgumentException]
Could not find package laravel/laravel with version 6.*.
Here is a screenshot
If i use:
composer create-project --prefer-dist laravel/laravel blog
It install the v5.5.28
Here is a screenshot
What can be the problem?
Which PHP version you are using? Laravel-6.* need PHP >= 7.2.0. Check your server-requirements for Laravel 6.*. May be you did not meeting the requirements for laravel 6.*. And after meeting the requirements run your command inside htdocs folder for xampp or www folder for wamp webserver.
your command are no longer supports so you should use:
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
You forgot to add the "--prefer-dist " . So in your case, you have to use the:
composer create-project laravel/laravel --prefer-dist
in order to make it work. So just remove all the files from: d:\xampp\htdocs\laravel and then try again by following the below commands to your cmd (I guess you are using Windows!):
cd d:\xampp\htdocs\laravel
composer create-project laravel/laravel --prefer-dist
I think this should work for you just fine
You don't need to specify the version of Laravel 6. By default, Laravel 6 installs the latest version and its extension.
As I'm writing now the current and latest version of Laravel is: Laravel 6.0.4
The command below will install the current and the latest version in your laravel6 project.
composer create-project --prefer-dist laravel/laravel laravel6
You don't need to specify the version of Laravel 6. By default, Laravel 6 installs the latest version and its extension.
Via Composer Create-Project
Alternatively, you may also install Laravel by issuing the Composer create-project command in your terminal:
composer create-project --prefer-dist laravel/laravel your_project_name
I think it will be helpful for you. for more details visit laravel official website : https://laravel.com/docs/6.x/installation
Please check the permissions on the cache dir (/home/keynes/.composer/cache)
It's complaining it cannot write to this dir, or it may not exist.
Maybe it is installing an older laravel version from the cache dir.
Kindly upgrade your PHP version on your system.
Then install laravel commands
It will automatically install the lettest version depends on the PHP version.
Or you can mention on laravel command and set the laravel version like "6.0*" behind the laravel installer command.
I hope this will works 😊
The commands you are running should work. I would try clearing the composer cache:
composer clear-cache
and then
composer update
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
before trying again. Looking at the screenshots there seem to be some permissions errors in the ~/.composer directory. This might also cause the composer clear-cache command to fail with an error.
So if clearing the cache doesn't work or you get an error, you might try moving the ~/.composer directory to a backup location, to force composer to regenerate it's settings.
mv ~/.composer ~/.composer.backup
And then try it again (be aware that composer update will likely take a noticeably longer time than usual and might be unresponsive for a while):
composer update
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
If it still doesn't work, then you can restore the backup:
rm -rf ~/.composer
mv ~/.composer.backup ~/.composer
Then looking at the output of
composer config --list --global
might help determine the next thing to try.

Laravel 5.5 wont install with php7

I try to install Laravel 5.5 version so I run command:
composer create-project laravel/laravel test 5.5.*
but I got this error:
If you see the top of image I run command php -v and its clear that version i 7.0.27
How to solve my issue?
You can try to update your composer:
composer update
Or try to use the full php7 path, example:
/path/to/your/php7 composer.phar create-project laravel/laravel test 5.5.*
Seem your XAMPP not installed properly. Uninstall existing XAMPP and manually delete the entire folder. (take backup of htdocs if there s some files as well PHPmyadmin DB backups). And download XAMPP from here and install it.
Install composer
and run this
composer create-project --prefer-dist laravel/laravel test
It's PHP7, so composer install Laravel 5.5 or higher by-default
I had this issue and the problem was that an after php upgrade there was still two php versions running almost together, so, in my case composer was using one version of php and laravel use the other. To solve that problem i uninstalled all php versions, update my php repositories and then i made a fresh install of php, composer and laravel.
Nowadays I have laravel 5.5 running with php 7.2 and i added laravel in enviroment variables so when i need to creaste a new project i use laravel new project_name
Hope this helps you!
Don't specify a version for project
composer create-project --prefer-dist laravel/laravel test
By any chance is the PHP require value in composer.json not "php": ">=7.0.0"
Try adding --prefer-dist and remove 5.5.*
Laravel requires PHP >= 7.0.0, you currently have version 5.6.
Install a newer version of PHP or use homestead.

Laravel 5.5 install

When I try to install Laravel 5.5 with laravel new project --dev
[Symfony\Component\Debug\Exception\FatalThrowableError]
Parse error: syntax error, unexpected '<<' (T_SL), expecting ']'
It is just me or because it is not release yet?
EDIT:
Btw, it is when I try to make php artisan key:generate... If I put any key in .env it works...
Thanks
composer create-project laravel/laravel blog "5.5.*" --prefer-dist
To install Laravel 5.5 you need launch composer create-project as usual and you need to set the “dev-develop” version of the laravel/laravel package:
composer create-project --prefer-dist laravel/laravel blog dev-develop
Where:
laravel/laravel: is the package for Laravel installation;
blog: is the new directory for your new project (you can change it);
dev-develop: is the next version of Laravel.
Yuo can find more information here
https://medium.com/#robertodev/how-to-install-laravel-5-5-dev-d721873a8c89
I had the same problem.
For me even
php artisan
did not work.
I fixed it with a simple
cd /my/project/folder
composer update
php artisan key:generate
in the console.
Hope this helps.
This is happening because of your Laravel Installer version. I have faced the same problem.
Run following command:
composer global update (it will update your Laravel Installer)
If you don't want to install again, then fix by following command:
composer update (from your project directory and it will update your project files)
Additional:
Sometimes, it may cause of Composer version. You can update your composer version by following command:
composer self-update
Then you can update your project files.
Hope this answer will help you.

How to update Composer in Windows 10

I am using Composer for my PHP project. I am new to Composer. Now when I update my dependencies using composer update command, it is saying that my Composer version is too old and ask me to update. So I tried as below. But all failed.
My composer.phar file is in C:/ProgramData/ComposerSetup/bin/composer.phar
I opened terminal and tried
composer.phar update
php composer.phar update
composer C:/ProgramData/ComposerSetup/bin/composer.phar update
php composer C:/ProgramData/ComposerSetup/bin/composer.phar update
When I run composer-self-update, error as in screenshot.
All command failed. I am using XAMPP. There is no composer.phar file in xampp/php folder as well. How can I update Composer in Windows 10?
Try
composer self-update
If this doesn't work check your PATH variable, if it's not there try searching composer.bat in windows and add it to your PATH variable. Normally, its in following path.
C:\ProgramData\ComposerSetup\bin
Windows 10 update for Composer still works (end of 2020, pre version 2) with:
Follow This below Image:
composer self-update --1 it will be updated from 1.x
composer self-update --2 it will be updated from 2.x and from 1.x
composer self-update --rollback If you need to rollback to your previous version
composer -V For check your composer version
composer self-update:
If you run composer self-update from 1.x, it will warn you that a new stable major version of Composer is available, and you can use composer self-update --2 to migrate to it.
So run composer self-update --2
How easy is it to upgrade?
Composer 2.0 still supports PHP 5.3 and above, much like Composer 1.x
composer.lock files are interoperable between versions, so you can
upgrade to 2.0 and roll back easily if needed.
Most commands and arguments remain the same, and largely what you
know about Composer remains true in 2.0.
Windows 10 update for Composer still works (end of 2020, pre version 2) with:
composer self-update
If you need to rollback to your previous version, you can do that with:
composer self-update --rollback
Try.
php composer.phar self-update
'update' updates your dependencies not composer itself.
Use
composer self-update --2
By default, the installer and composer self-update will download the latest stable version only.
To programmatically install specific major versions you can use the --1 or --2 flag.
To go back to the previous version:
composer self-update --rollback
To check the current version
composer --version

Categories