简体   繁体   中英

Vue.js build on Gitlab CI/CD not producing any artifacts in `/dist` directory

I'm attempting to add a build stage to my CI/CD pipeline that I'm running on Gitlab.com. The build seemingly 'completes' without error, but the /dist directory remains empty after the build.

Here's the relevant config from my gitlab-ci.yml file:

在此处输入图片说明

But the result as seen in the runner logs is an empty /dist directory:

在此处输入图片说明

The runner reports that it found one matching files , but I'm assuming that it's counting the empty /dist dir as the file that it found because the directory itself is empty, which causes my deploy stage to fail when it tries to upload the missing artifacts.

Does anyone have any idea what's going on here?

The build seems to succeed just fine, but there's no resulting files in the /dist directory. And with that in mind, where are they going then?

I've tried many different representations of the path, and even tried utilizing the process.env.CI_PROJECT_DIR var as the value in my webpack.config file(s) but I can't get the artifacts to land in the /dist dir.

When I download the artifacts .zip file using the Gitlab.com console I just end up with an empty folder.

Thanks in advance for any light anyone can shed on this.

There's probably nothing wrong with the artifacts creation, but there could be something wrong with the npm run build part of the job. I usually get this problem when npm run build fails (for example, the CI env does not have the proper packages installed in node_modules ), so nothing gets put under the dist folder. The problem is that Gitlab CI will not abort the job when npm run build fails, and it would still continue up to the artifacts creation, which as you reported, will zip-up an empty dist folder.

Check that the npm run build part of the job actually succeeds.

I don't know much about npm running on gitlab ci, but it may be what you need. Gitlab CI: create dist folder inside repository?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM