TravisCI throwing "Public Directory Not Found" Error

I am building a static resume website as a fun project.

It is being built with Angular/Firebase/GitHub/TravisCI. I am completely new to the last two.

When pushing changes to my repository through Visual Studio Code, TravisCI was throwing the error “Public Directory Not Found.”

I have my Firebase public directory set to “dist” which is what angular cli builds my app into.

This was my initial .travis.yml file

language: node_js
  - "10.4"
    - master
  - npm install -g @angular/cli
  - ng build --prod
  - npm install -g firebase-tools
  provider: firebase
    secure: $FIREBASE_TOKEN
  project: "my-project"

Someone suggested adding

skip_cleanup: true

under the deploy parameter. However this did not fix the issue.

So then I tried adding

- npm install

under the script parameter and it worked! but I have no idea why.

I guess what I am wondering here is why do I need that npm install line under the script parameter? Or DO I need it?

I am pretty new to GitHub/TravisCI, so I apologize if these are very basic questions/I am doing all of this completely wrong.