Laravel installation error

Posted on

Question :

Folks, I’m using Mac and trying to install Laravel. I already installed composer , I ran the command line documented in the framework:

composer global require "laravel/installer=~1.1"

It does everything ok, but when I try

laravel new blog

It gives the laravel command does not exist.

I’m creating within the htdocs of xammp.

How could I fix this?

Thank you

    

Answer :

You must have /Users/seu-nome-de-usuario/.composer/vendor/bin in your Path so that the laravel executable can be used in any system folder.

To check if your path contains the composer path run the

echo $PATH

and see the output

If not, you can add the path with the

sudo vim /etc/paths

And add in the last line

/Users/seu-nome-de-usuario/.composer/vendor/bin

or if you override paths in your terminal settings you can use

sudo vim ~/.zshrc

and add the line

export PATH="${PATH}:/Users/seu-nome-de-usuario/.composer/vendor/bin"

    

In xamp I was able to solve this problem like this:

Open your .bash_profile :

vim ~/.bash_profile

And copy the following line at the end of the file:

export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"

Save, and then reboot like this:

source ~/.bash_profile

Anything try to create your projects like this:

composer create-project laravel/laravel --prefer-dist

It’s the same as laravel new project .

    

Leave a Reply

Your email address will not be published. Required fields are marked *