Composer Command not found

Jyotishgher Astrology
By -
0

How to fix Composer Command not found


The error message "bash: composer: command not found" indicates that the Composer executable is not found in your system's PATH. Since you installed Composer by downloading the composer.phar file, you need to either run it directly using PHP or move it to a directory that is included in your PATH for easier access. Composer is the PHP dependency manager. Whenever your site or application needs third-party code or libraries, it's generally a good idea to include them with Composer. After all, if your code requires a library, and that library requires another one, Composer will manage that for you.

How to install Composer globally on Linux

Here are a few options to resolve this:

  1. Run Composer directly: Since you have composer.phar in your home directory, you can run it using the following command:

    bash
    php ~/composer.phar
    
  2. Move Composer to /usr/local/bin: To make Composer globally accessible, you can move the composer.phar to a directory that is included in your PATH. Here’s how you can do it:

    bash
    sudo mv ~/composer.phar /usr/local/bin/composer
    sudo chmod +x /usr/local/bin/composer
    

    After doing this, you should be able to run Composer simply by typing:

    bash
    composer
    
  3. Check your PATH: If you need to check which directories are included in your PATH, you can use:

    bash
    echo $PATH
    

    Ensure that /usr/local/bin is included in the output.

After following one of these methods, Composer should be accessible from any directory in your terminal session.

Conclusion

If you followed all the steps in this guide correctly, the newly completed Laravel installation will allow you to start a new application.

Tags:

Post a Comment

0Comments

Post a Comment (0)