javascript - Nuxt/Gitlab : WARNING: public: no matching files ERROR: No files to upload

标签 javascript gitlab vuetify.js nuxt.js

我正在尝试在 Gitlab 上部署我的 Nuxt.js/Vuetify 应用程序。我的应用程序在我的本地计算机上运行良好。

.gitlab.ci.yml

这是我的 .gitlab-ci.yml 文件,如Nuxt.js official documentation建议的那样:

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

屏幕截图

enter image description here

有什么提示吗?

最佳答案

有两种方法

  1. 您可以更改 nuxt.config.js 文件中生成的文件夹
module.exports = {
 // custom generated folder
  generate: {
    dir: 'public'
  }
}
  • 您可以将内容从 dist 文件夹移动到公用文件夹
  • script:
      - npm run build
      - mv dist public
    

    关于javascript - Nuxt/Gitlab : WARNING: public: no matching files ERROR: No files to upload,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52293352/

    相关文章:

    javascript - 通过 NodeJS 使用 HTML 文件加载 JS 文件的正确方法

    javascript - webkit 中的 Jquery css 值

    git - 在GITLAB上为git用户提供交互式服务

    vue.js - 如何创建基于 Vuetify 的浏览器扩展?

    javascript - 在 Django 模板中访问 Javascript 变量

    javascript - D3 map - 将多边形排除在悬停之外

    git - 如何在不 fork 的情况下复制 gitlab/github 上的 git 存储库?

    redmine - Gitlab - 更新配置以与 redmine 一起使用并重新部署

    vue.js - 如何为每次迭代分配 v-model

    vue.js - 验证 : Add Button or Link to Expansion Panel Header