Saturday, February 25, 2017

Laravel: Failed to connect to port 80 on OSX

Recently I was trying to create new Laravel application with Laravel installer, it was not working and it was throwing following error.

Failed to connect to port 80: Operation timed out [url]

I was not sure about error so I tried few things like updating composer and updating laravel installer but still it was not working but finally I was able to solve problem so in this blog I am going to explain how to solve this issue.

This issue is because even after updating laravel installer version with composer it's still using old version of composer which was installed in /usr/local/bin library. To find out this type following command in terminal.

laravel --version

If it shows following output that means you are still using old version of laravel installer.

Laravel Craft version 1.0.0

So to remove this version first of all remove old version. Go to terminal and type following command.

rm /usr/local/bin/laravel

Now will again install laravel with following command.

composer global require "laravel/installer"

It will install laravel in your users home directory, so you have to add path to it in your bash_profile file. Open the bash_profile file for editing.

sudo nano ~/.bash_profile

And copy following line in it.

export PATH=/Users/USERNAME/.composer/vendor/bin:$PATH

In above line replace USERNAME with your OSX username. Save the file and reopen the terminal. Now again type following command.

laravel --version

And it will show following output.

Laravel Installer version 1.3.1

So now you have the latest version of laravel installer, create new laravel application with following command

laravel new app-name

Hope this helps you.

No comments:

Post a Comment