How to Fix Laravel New Command Not Found?

laravel new command not found

If you’ve tried running Laravel new and got hit with the dreaded “command not found” error, you’re not alone. This issue usually pops up when Laravel isn’t installed globally or when your system can’t find the Laravel installer.

It can be frustrating, especially when you’re just getting started with Laravel. But don’t worry — fixing it is straightforward.

In this blog, we’ll walk you through some quick fixes to troubleshoot Laravel New Command Not Found and get your Laravel projects up and running in no time. So, let’s get started!

What Causes the Laravel New Command Not Found Error?

The Laravel New Command Not Found error usually means your system doesn’t recognize the Laravel command in the terminal. Below are the most common reasons why it happens:

  • Laravel Installer Isn’t Installed Globally: The laravel new command only works if you’ve installed the Laravel installer globally using Composer. Without it, your system won’t know what Laravel refers to.
  • Global Composer Bin Path Isn’t in Your PATH: After installing the Laravel installer, the actual executable lives in Composer’s global vendor/bin directory. If that directory isn’t added to your system’s PATH, your terminal won’t be able to find and run the command.
  • Composer or PHP isn’t Set Up Properly: If Composer or PHP isn’t installed or isn’t available globally (i.e., accessible via terminal commands), Laravel’s installer won’t work. These are required tools that must be installed first.
  • Terminal Session Wasn’t Restarted: Sometimes, after installing or updating environment variables, the changes don’t apply until you restart your terminal session or log out and back in.
  • Using the Wrong Terminal on Windows: In some cases, the laravel command works in one terminal (like Git Bash or WSL) but not in another (like CMD or PowerShell), depending on how your PATH is configured.

Even though this error looks intimidating at first, it usually comes down to just a few small configuration steps. Once we fix those, you’ll be ready to start using Laravel new without any hiccups.

Stuck With Laravel Setup Issues? We’ve Got Your Back!

Getting Laravel Installer Working: Complete Setup Guide

Before you can use the Laravel new command, a few things need to be set up properly. This section walks you through everything, from installing the Laravel installer to configuring your system so the command works smoothly in any terminal.

Step 1: Make Sure PHP and Composer are Installed

The Laravel installer depends on PHP and Composer, so these must be available on your system globally.

  • To check PHP:
php -v
  • To check Composer:
composer --version

If either command gives a “not found” message, you’ll need to install it:

Step 2: Install Laravel Installer Globally via Composer

Once PHP and Composer are ready, install the Laravel installer with:

composer global require laravel/installer

This command downloads the Laravel CLI tool and places it in Composer’s global bin directory. But you’re not done yet–your terminal needs to know where to find it.

Step 3: Add Composer’s Global Bin to Your PATH

Depending on your OS, you’ll need to add the correct Composer bin path to your environment’s PATH variable.

For Linux (Ubuntu/Debian):

  1. Locate the global bin path:
echo $HOME/.config/composer/vendor/bin
  1. Add it to your shell config (e.g., .bashrc or .zshrc):
echo 'export PATH=\"$HOME/.config/composer/vendor/bin:$PATH\"' >> ~/.bashrc
source ~/.bashrc

For macOS:

Most steps are similar to Linux. Use this for zsh (default on newer Macs):

echo 'export PATH=\"$HOME/.config/composer/vendor/bin:$PATH\"' >> ~/.zshrc
source ~/.zshrc

For Windows:

  1. Find the Composer bin directory, typically:
%USERPROFILE%\\AppData\\Roaming\\Composer\\vendor\\bin
  1. Go to System Properties → Environment Variables.
  2. Under “System variables,” find and edit the Path variable.
  3. Add the bin path and restart your terminal.

Step 4: Test the Setup

Run the following command to check if the Laravel installer is working:

laravel --version

OR

laravel -v
1 2

Then, try creating a project:

laravel new my-app
2 2

If everything is set up correctly, you should see Laravel begin building a new project in the my-app directory.

Once your environment is correctly configured, the laravel new command becomes a reliable way to start any Laravel project. With these setup steps complete, you’re ready to develop with confidence.

Alternative Option: Create Laravel Projects Using Composer Directly

If the Laravel new command still isn’t working or you prefer not to use the Laravel installer, you can skip it entirely and use Composer to create a new Laravel project. This method is just as effective and works reliably as long as Composer is installed properly.

Use This Command:

Run the following in your terminal to create a new Laravel project:

composer create-project laravel/laravel my-app
3 2

This command does everything the installer would do: it downloads Laravel, sets up the directory structure, and installs dependencies. The my-app folder will contain your new project.

You Can Also Specify a Laravel Version:

If you want to install a specific version of Laravel (e.g., 11.x), use:

composer create-project laravel/laravel:^11.0 my-app
4

Using Composer directly is a solid fallback that works across all platforms without needing extra configuration. It’s a great option if you just want to get started quickly or avoid adjusting your system’s PATH settings.

Common Troubleshooting Tips

Even after following all the setup steps, you might still run into issues. Don’t worry — most of the time, it’s something minor that’s easy to miss.

Before you start overthinking or reinstalling everything, go through these quick checks. They’ll help you pinpoint the problem and get back to coding faster.

Still Getting “Command Not Found”?

The most common cause here is the Laravel installer not being accessible globally. This usually happens when the global Composer vendor/bin directory isn’t correctly added to your system’s PATH.

To check if it’s added:

  • Run echo $PATH on macOS/Linux or echo %PATH% on Windows.
  • Look for something like ~/.composer/vendor/bin (older systems) or ~/.config/composer/vendor/bin (newer systems).

If it’s not there, you’ll need to manually add it to your shell config file like .bashrc, .zshrc, or .bash_profile.

Pro tip: After making changes, always reload your terminal using source ~/.bashrc (or the file you edited) or restart the terminal entirely.

A lot of people edit the correct file but forget to reload it, and the command still won’t work.

Permission Denied Errors?

This is more common on Linux and macOS systems due to restricted write access in certain folders. If you’re getting permission errors while installing globally, prefix the command with sudo like this:

sudo composer global require laravel/installer

This gives the necessary system-level permissions to complete the installation.

For Windows users, you might not see a “permission denied” message directly, but certain installs might silently fail. So, make sure to run your terminal as an Administrator.

Laravel Installed Locally Instead of Globally?

Sometimes, developers install Laravel inside a project without realizing it’s only accessible in that one folder.

So when they try to use Laravel elsewhere, the command fails. To fix this, just run the global install command again:

composer global require laravel/installer

This ensures Laravel is available system-wide, not just inside a single project. After this, Laravel new should work from any directory, assuming your PATH is set correctly too.

Using the Right Terminal?

This might sound basic, but the terminal you use can make a difference, especially on Windows. If you’re using Command Prompt or PowerShell and nothing’s working, try switching to:

  • Git Bash: Comes with Git for Windows. More Unix-like and often handles PATH variables better.
  • WSL (Windows Subsystem for Linux): Great if you’re comfortable with a Linux-style environment inside Windows.

These alternatives tend to handle environment configs more reliably and make tools like Composer behave more consistently.

Bonus Tips to Improve Your Laravel Setup

Once you’ve resolved the Laravel new issue, there are a few extra things you can do to make your development environment even smoother and more productive.

Create a Terminal Alias (Optional but Handy)

If typing out full commands feels repetitive, you can create a short alias for the Laravel installer.

For example, add this to your .bashrc or .zshrc file:

alias newlaravel='laravel new'

Now, you can just run:

newlaravel my-app

Organize Your Projects Folder

Keep all your Laravel apps in one place, like a ~/Code or ~/Projects directory. This keeps your system tidy and makes navigation easier.

Keep Dependencies Updated

Update the Laravel installer and Composer regularly:

composer global update laravel/installer
composer self-update

This helps avoid compatibility issues down the line.

Use Laravel Valet (macOS) or Laragon (Windows)

Tools like Laravel Valet for macOS and Laragon for Windows offer fast, local Laravel environments with zero configuration.

Little tweaks like these can help you stay organized, save time, and avoid small headaches as your projects grow.

Need Custom Laravel Solutions? You’re in the Right Place.

FAQs on Laravel New Command Not Found

How do I create a new command in Laravel?

To create a new command in Laravel, use Artisan – php artisan make:command YourCommandName. This creates a file in app/Console/Commands.

How to register a command in Laravel?

Follow these steps to register a command in Laravel:
1. Open app/Console/Kernel.php.
2. Inside the $commands array, add your command class like this:
protected $commands = [
    \App\Console\Commands\YourCommandName::class,
];

Now you can run it using php artisan your:signature.

How to start a Laravel project command?

There are two ways to start a Laravel project command:
1. Using Laravel Installer (if globally installed):
laravel new project-name
2. Using Composer (without installer):
composer create-project laravel/laravel project-name
Both will set up a fresh Laravel project in a folder named project-name.

Let’s Summarize

Running into the “laravel new” command not found error can be annoying, but it’s usually easy to fix once you know where to look. Whether it’s a missing PATH variable, a permission issue, or using the wrong terminal, small things can cause big roadblocks.

The key is to take it step by step and double-check your setup. Once everything’s in place, you’ll be able to spin up new Laravel projects in seconds without any issues. And don’t forget the bonus tips — they’ll help you keep your Laravel environment clean, fast, and easy to work with.

If you need advanced help with your Laravel project, consider consulting a Laravel development agency for the best results.

author
Mayur Upadhyay is a tech professional with expertise in Shopify, WordPress, Drupal, Frameworks, jQuery, and more. With a proven track record in web development and eCommerce development.
Leave a comment