Failed during stage 'building site': Deploy directory 'dist' does not exist

Hello, I’m working on a Nuxt.js project and I’m getting the error in my title.

Failed during stage 'building site': Deploy directory 'dist' does not exist

I was thinking this might be because I hadn’t created my dist folder, so I did this with nuxt generate, and the dist folder now exists in my project, but I can’t see it up on my Github repo. Would this be the problem?

I recently deployed a Vue.js site on Netlify, but it worked fine while I was still missing my dist folder in my Github repo.

Can someone please help me out?

hey there,

could you post a screenshot of your build settings and also your package.json please?

I feel fairly sure this is a config issue we can quickly resolve.

Hello, thank you so much!!
Here is my package.json:
Screen Shot 2020-07-09 at 22.03.16|690x216](upload://5bpzpKPmcpm4zg5AdMYkbgZdhLw.jpeg)

Here is my build settings:

Hey @mikumikumiku914,

I think you should check out what each build path/setting is intended for.

In your case, dist should contain all of the HTML and ‘deploy ready assets’ and follow Nuxt’s guide on deploying to Netlify :+1:!

Thank you for this @Scott.
I tried entering npm run build for my build command, left dist as the publish directory, but I’m still getting Deploy directory 'dist' does not exist. Am I missing something?

Does dist contain all of the HTML and ‘deploy ready assets’ as mentioned above? If it’s empty, it won’t get built.

The html files are in the dist file, but I’m not sure how I should check where ‘deploy ready assets’ are?

According to your build parameters, you should have:

reponame/dist/[files]

Make sure this dist folder isn’t in a .gitignore file if you have one!

2 Likes

I was having this problem after i added target: 'static', in nuxt.config

export default {
  target: 'static',

}

Just delete target: 'static', and default value will take place

Use “nuxt generate” instead of “nuxt build” in your build command settings.

1 Like

just comment the dist in the .gitignore file, that’s solved the Probleme for me
# Nuxt generate
# dist

Thank you for sharing that solution, @okuninoshi. We appreciate it!

I am not so sure about this and would like to keep the discussion going.

I have had the same issue and solved it by changing the command to npm run generate instead of npm run build.

but what is going on behind the scenes, I’d like to understand the steps.

with npm run build, no dist folder was found and therefore deploy returned an error. but to build the page locally and push a dist folder by removing it from the gitignore seems wrong to me, why in the first place is it listed in the gitignore then?!

here is what I did: created the nuxt project and pushed content to master (without a dist folder). am I right that the dist is being build by netlify as soon as I push to master (bc of the npm run generate command). meaning there is no need to remove .nuxt and dist from the gitignore file.

1 Like

thank you work for me, before use npm run generate i use npm run build and and it failed I looked for a solution and found it you said use npm run generate and it was very useful for me thank you

This was my issue. My web-build folder for my React Native project was in the .gitignore and so was getting this error that the web-build folder doesn’t exist.