我正在尝试通过Travis CI在Firebase主机上部署,但是在我的构建生成要部署的静态文件后,部署阶段似乎找不到输出中的文件www。特拉维斯会删除脚本和部署之间的文件吗?
.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/**"
]
}
}
这是我的特拉维斯构建日志:
...
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
当./www/index.html
不存在时,将导致404
正如这所暗示的那样,位置必须是: "public": "./www"
.