简体   繁体   中英

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

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM