kerelka's avatar
Level 15

Can't upgrade laravel installer to newest Laravel 12 ?

When laravel 12 first come, i want to upgrade my laravel installer so i can work with new laravel 12 starter kit.

I tried:

composer global require laravel/laravel

Log says my laravel installer can upgrade to the newest one. I did upgrade. BUT, turn out it DOESN'T.

I search for the solution and found several answer, one of the solution is re-install Laravel installer. So i tried:

composer global remove laravel/laravel
composer global require laravel/laravel

and... it's not solve the problem. after couple hours struggle, I Found out that i use Two different laravel installer.

the other one that my default laravel installer used is from HERD.

Turn out i've been upgrade Laravel installer on my global computer instead of HERD. so when i check:

laravel --version

it use the Laravel installer from HERD instead. In order to upgrade, i just need to update HERD.

I hope this can help someone who have same silly issue like mine LOL

1 like
4 replies
LaryAI's avatar
Level 58

To resolve the issue of upgrading the Laravel installer to work with Laravel 12, it's important to understand the distinction between the global Laravel installer and any other package managers or environments like HERD that might be managing your Laravel installations.

Here's a step-by-step solution:

  1. Check Current Laravel Installer Version: First, verify which Laravel installer is being used by running:

    laravel --version
    
  2. Identify the Source of the Installer: If the version is not what you expect, it might be due to another package manager like HERD managing the Laravel installation. You can check your system's PATH to see which executable is being prioritized.

  3. Update the Global Laravel Installer: If you want to update the global Laravel installer, use:

    composer global require laravel/installer
    
  4. Update HERD (if applicable): If HERD is managing your Laravel installation, you need to update HERD itself. The process for updating HERD will depend on how HERD is installed on your system. Typically, you might need to refer to HERD's documentation for the update process.

  5. Verify the Update: After updating, verify the version again:

    laravel --version
    
  6. Ensure Correct PATH Configuration: Make sure your system's PATH is configured to prioritize the correct Laravel installer. You can adjust your PATH in your shell configuration file (e.g., .bashrc, .zshrc) to ensure the global Composer bin directory is prioritized.

By following these steps, you should be able to ensure that your Laravel installer is updated to the latest version and is correctly configured to work with Laravel 12.

ranjan3nov's avatar

@LaryAI

The steps you are suggesting i have already tried but it won't work it just give laravel 5.1 as the latest laravel installer

Tray2's avatar

Yes, if you use herd you need to upgrade the installer in herd. I would suggest removing the other one so that you aren't confused the next time.

mynhinguyentruong's avatar
Level 1

Hey, I ran to the same issue on my Mac M2 and here is the issue:

  • When I run composer global update, it updates the composer in my ~/.composer/vendor/bin/composer. However when I run which composer and which laravel, the output of binary for laravel and composer are different paths.

To fix it, you need to tell the machine the correct binary composer and laravel to use, so the fix is:

  • Find where you global composer located by running: composer global config bin-dir --absolute
  • Add it to your SHELL PATH: export PATH="$HOME/.composer/vendor/bin:$PATH" if the output above was "/Users/yourname/.composer/vendor/bin"
  • Or just run ~/.composer/vendor/bin/laravel new --using to create new laravel app
1 like

Please or to participate in this conversation.