找不到Travis部署Firebase托管文件

时间:2019-01-19 13:09:55

标签: firebase travis-ci firebase-hosting firebase-cli

我正在尝试通过Travis CI在Firebase托管上进行部署,但是在生成生成要部署的静态文件后,部署阶段似乎在输出跟踪器中找不到文件< strong> www 。 Travis是否删除脚本部署之间的文件?

.travis.yml

---
language: node_js
node_js:
  - lts/*
install:
  - npm install @vue/cli
  - npm install
script:
  - npm test
  - npm run build
deploy:
  provider: firebase
  project: my-firebase-project
  token:
    secure: FIREBASE_SECURE_TOKEN
cache:
  directories:
    - node_modules

firebase.json

{
  "hosting": {
    "public": "www",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

这是我的Travis构建日志:

...

 DONE  Build complete. The www directory is ready to be deployed.
 INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

...

=== Deploying to 'my-firebase-project'...
i  deploying database, hosting
i  database: checking rules syntax...
✔  database: rules syntax for database my-firebase-project is valid
i  hosting[my-firebase-project]: beginning deploy...
i  hosting[my-firebase-project]: found 0 files in www
✔  hosting[my-firebase-project]: file upload complete
i  database: releasing rules...
(node:6919) UnhandledPromiseRejectionWarning: Error
    at new FirebaseError (/home/travis/.nvm/versions/node/v10.15.0/lib/node_modules/firebase-tools/lib/error.js:11:16)
    at Object.reject (/home/travis/.nvm/versions/node/v10.15.0/lib/node_modules/firebase-tools/lib/utils.js:135:27)
    at /home/travis/.nvm/versions/node/v10.15.0/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:60:20
    at arrayEach (/home/travis/.nvm/versions/node/v10.15.0/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/home/travis/.nvm/versions/node/v10.15.0/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:9344:14)
    at module.exports (/home/travis/.nvm/versions/node/v10.15.0/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:39:5)
    at _chain (/home/travis/.nvm/versions/node/v10.15.0/lib/node_modules/firebase-tools/lib/deploy/index.js:26:38)
    at /home/travis/.nvm/versions/node/v10.15.0/lib/node_modules/firebase-tools/lib/deploy/index.js:29:14
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6919) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6919) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✔  database: rules for database my-firebase-project released successfully
i  hosting[my-firebase-project]: finalizing version...
Error: HTTP Error: 404, Not Found

1 个答案:

答案 0 :(得分:0)

./www/index.html不存在时,将导致404

根据this的提示,该位置必须为:"public": "./www"