最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - NuxtGitlab: WARNING: public: no matching files ERROR: No files to upload - Stack Overflow

programmeradmin0浏览0评论

I am trying to deploy my Nuxt.js/Vuetify app on Gitlab. My app works well on my local machine.

.gitlab.ci.yml

Here is my .gitlab-ci.yml file as suggested by the 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

Here is the content of my nuxt.config.js file:

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: ':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
    }
}

Error message

I am getting this error message:

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 :444/runner/project/8345221/default 
Created cache
Uploading artifacts...
WARNING: public: no matching files                 
ERROR: No files to upload                          
Job succeeded

Screenshot

Any hints?

I am trying to deploy my Nuxt.js/Vuetify app on Gitlab. My app works well on my local machine.

.gitlab.ci.yml

Here is my .gitlab-ci.yml file as suggested by the 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

Here is the content of my nuxt.config.js file:

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./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
    }
}

Error message

I am getting this error message:

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.:444/runner/project/8345221/default 
Created cache
Uploading artifacts...
WARNING: public: no matching files                 
ERROR: No files to upload                          
Job succeeded

Screenshot

Any hints?

Share Improve this question edited Sep 12, 2018 at 12:09 Billal BEGUERADJ asked Sep 12, 2018 at 10:48 Billal BEGUERADJBillal BEGUERADJ 22.8k45 gold badges123 silver badges140 bronze badges 7
  • 2 Do not include screen shots of text. Instead, just copy-and-paste the text directly into your question. – Jonathan Hall Commented Sep 12, 2018 at 10:50
  • Not clear what your problem. You want to make bundle smaller or it just dont work? – Aldarund Commented Sep 12, 2018 at 11:35
  • On my local machine, the Nuxt app works perfectly. I get that error on Gitlab where I want to do integration tests and deployment. @Aldarund – Billal BEGUERADJ Commented Sep 12, 2018 at 11:39
  • @BillalBEGUERADJ well bundle size is just a warning, its not a problem. I see a eror no files to upload and thats the reason probalby why its not working. – Aldarund Commented Sep 12, 2018 at 11:52
  • 1 you .gitlab-ci.yml dont look like yml at all :) – Aldarund Commented Sep 12, 2018 at 12:06
 |  Show 2 more ments

2 Answers 2

Reset to default 4

There are two way to do it

  1. you can change the generated folder in you nuxt.config.js file
module.exports = {
 // custom generated folder
  generate: {
    dir: 'public'
  }
}
  1. you can move the content from dist folder to public folder
script:
  - npm run build
  - mv dist public

I guess the problem is following:

  artifacts:
    paths:
      - public

Nuxt will generate into dist folder, not a public

So you need something like this

  artifacts:
    paths:
      - dist
发布评论

评论列表(0)

  1. 暂无评论