javascript - Nuxt/Gitlab:警告:公共:没有匹配的文件错误:没有要上传的文件
问题描述
我正在尝试在 Gitlab 上部署我的 Nuxt.js/Vuetify 应用程序。我的应用程序在我的本地机器上运行良好。
.gitlab.ci.yml
这是Nuxt.js 官方文档.gitlab-ci.yml
建议的我的文件:
image: node
before_script:
- npm install
cache:
paths:
- node_modules/
pages:
script:
- npm run generate
artifacts:
paths:
- public
only:
- master
nuxt-config.js
这是我的 nuxt.config.js 文件的内容:
module.exports = {
/*
** Headers of the page
*/
head: {
title: 'fending4',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', type: 'text/css', href: 'https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons'}
]
},
/*
** Customize the progress bar color
*/
loading: { color: '#3B8070' },
/*
** Build configuration
*/
build: {
/*
** Run ESLint on save
*/
extend (config, { isDev, isClient }) {
if (isDev && isClient) {
config.module.rules.push({
test: /\.(js|vue)$/,
enforce: 'pre',
loader: 'eslint-loader',
exclude: /(node_modules)/
});
config.module.rules.push({
test: /\.css$/,
loader: ['css-loader', 'stylus-loader'],
exclude: /(node_modules)/
});
};
}
},
maxChunkSize: 400000,
performance: {
hints: false
}
}
错误信息
我收到此错误消息:
2018-09-12T10:33:22.028Z nuxt: Call generate:distRemoved hooks (1)
2018-09-12T10:33:22.028Z nuxt:generate Destination folder cleaned
2018-09-12T10:33:22.034Z nuxt: Call generate:distCopied hooks (1)
2018-09-12T10:33:22.034Z nuxt:generate Static & build files copied
2018-09-12T10:33:22.037Z nuxt:render Rendering url /
2018-09-12T10:33:24.320Z nuxt: Call generate:page hooks (1)
2018-09-12T10:33:24.321Z nuxt:generate Generate file: /index.html
2018-09-12T10:33:24.324Z nuxt:render Rendering url /
2018-09-12T10:33:24.325Z nuxt: Call generate:done hooks (1)
2018-09-12T10:33:24.326Z nuxt:generate HTML Files generated in 24.5s
2018-09-12T10:33:24.326Z nuxt:generate Generate done
Creating cache default...
node_modules/: found 22322 matching files
Uploading cache.zip to http://runners-cache-3-internal.gitlab.com:444/runner/project/8345221/default
Created cache
Uploading artifacts...
WARNING: public: no matching files
ERROR: No files to upload
Job succeeded
截屏
有什么提示吗?
解决方案
有两种方法可以做到
- 您可以更改 nuxt.config.js 文件中生成的文件夹
module.exports = {
// custom generated folder
generate: {
dir: 'public'
}
}
- 您可以将内容从 dist 文件夹移动到 public 文件夹
script:
- npm run build
- mv dist public
推荐阅读
- python - 语法错误:循环中 else 运算符行的语法无效
- c - 添加多个字符串时的scanf问题
- java - 配置 brew install 以使用自定义命令执行
- python - 如何将切片字符串中的单个字符转换为 Python 中的整数?
- javascript - 在控制器 NestJS 中的对象内获取 .env 变量
- python - 在训练期间如何在每个 epoch 结束时调用测试集?我正在使用张量流
- bash - 根据另一个文件中的值替换变量
- sql - 将列插入到其中一列不允许空值的新表中
- java - Java FileInputStream.read() 打印时显示不需要的字符
- apache-spark - 如何使用 PySpark 过滤当前日期的 PySpark DataFrame