Resource: Uploading Laravel Project to Heroku

I decided to deploy my prototype for the Hackurculture hackathon to Heroku. Found a useful video that helped me and I thought I should share.

Trouble shooting

Creating Heroku App With a name

In his tutorial he did not specify a name for the app so one was generated randomly. To create your app with your desired name:

heroko create yourAppName

To change the random name generated:

heroku apps:rename newAppName

Source: https://devcenter.heroku.com/articles/renaming-apps#updating-git-remotes

Error: Refspec master does not match any

error: src refspec master does not match any.

error: failed to push some refs to ‘https://git.heroku.com/izikoapp.git’

When you use this command: git commit -m ‘initial release’, you might have seen this:

*** Please tell me who you are.

Run

  git config –global user.email “you@example.com”

  git config –global user.name “Your Name”

to set your account’s default identity.

Omit –global to set the identity only in this repository.

fatal: unable to auto-detect email address (got ‘michelleenakeno@mac.(none)’)

Set up your email and name. In my case I did the set up for the current project directory (omit –global)

git config user.email "myemail@email.com"

git config user.name "My Name"

Run the command again:

git commit -m "initial release"

Everything should be working fine now.

Laravel 8 Auth

Install Laravel UI package

composer require laravel/ui

Generate auth scaffolding

php artisan ui vue --auth

Install npm dependencies

npm install

Compile assets

npm run dev

Upgrade PHP version

#update brew
brew update

#this command will install php7.4 and other dependencies
brew install php@7.4

#or you can use this command instead
brew upgrade php

When I use the command ‘php -v’, I still get the ‘php7.2‘. Here’s how to switch to the newer version.

Find the .bash_profile file. In my case the path: /Users/michelleenakeno/.bash_profile

Edit with ‘TextEdit’ and add this:

export PATH="/usr/local/opt/php@7.4/bin:$PATH"

Save and close. Check your current php version and you should see 7.4

php --v

NOTE: if you are not sure about where your php path is, you can use the old path location as a hint. Use this command:

which php

If you check your current php version and the changes haven’t reflected, close your terminal and open it again or use this command:

source ~/.bash_profile reset

NOTE: you can edit the .bash_profile directly from the command line by using this command:

vim .bash_profile

Upgrade/Update composer

Update composer in the command line. CD into the directory where you installed composer.

#find composer path with this command
composer config --list --global

#look for this line -> [home] /Path/To/.composer

#change directory and update
cd .composer
composer update

Laravel Global Variable

Use the same technique for adding ‘php7.4 path to .bash_profile.

export PATH="~/.composer/vendor/bin:$PATH"

Packagist could not be fully loaded

Error: http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date

Use this command:

composer config -g repo.packagist composer https://packagist.org
composer config -g github-protocols https ssh

Source: https://laracasts.com/discuss/channels/laravel/why-showing-this-error