Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis with firebase hosting and create-react-app: can't find public directory

I've followed the instructions yet my travis build is failing because of:

Specified public directory does not exist, can't deploy hosting

The yarn build succeeds but deployment fails. Could it be that the firebase gem of Travis is ignoring the hosting/public key in the firebase.json?

My .travis.yml

  language: node_js
  warnings_are_errors: false
  node_js:
  - '9'
  before_script:
  - export CI=false
  cache:
    yarn: true
    directories:
      - node_modules
  before_deploy:
    - yarn build
  deploy:
    provider: firebase
    token:
      secure: xxx
  env:
    global:
    - secure: xxx

My firebase.json

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}
like image 366
Guy Avatar asked Jan 28 '23 15:01

Guy


1 Answers

add

deploy:
   skip_cleanup: true

to your .travis.yml . The git stash --all step will remove your local build directory before the deploy phase. Hence it can't find your build dir.

like image 95
kncvetko Avatar answered Feb 02 '23 04:02

kncvetko