Home
Support Forums

Deploy did not succeed: Deploy directory 'out' does not exist

Hello guys, I am a beginner in web development. I have a problem in deploying an application. I would love to deploy it but this error is preventing me from continuing. If anyone there can help, I will be very grateful.

my package.json: and below are the logs

{

“name”: “simple-nextjs-quick-start”,

“version”: “1.0.0”,

“description”: “Nextjs quick start”,

“scripts”: {

"test": "jest --passWithNoTests",

"lint": "eslint src",

"dev": "next",

"build": "next build",

"start": "next start",

"deploy": "yarn build && next export",

"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|json)\""

},

“author”: “Guilherme Louro”,

“license”: “MIT”,

“devDependencies”: {

"@ testing-library/react": "^10.0.4",

"@ types/jest": "^25.2.3",

"@ types/react": "^16.9.36",

"@ types/styled-components": "^5.1.0",

"@ typescript-eslint/eslint-plugin": "^3.2.0",

"@ typescript-eslint/parser": "^3.2.0",

"babel-eslint": "^10.1.0",

"babel-plugin-styled-components": "^1.10.7",

"eslint": "^7.1.0",

"eslint-config-prettier": "^6.11.0",

"eslint-plugin-import": "^2.20.2",

"eslint-plugin-node": "^11.1.0",

"eslint-plugin-prettier": "^3.1.3",

"eslint-plugin-react": "^7.20.0",

"eslint-plugin-react-hooks": "^4.0.4",

"jest": "^26.0.1",

"jest-styled-components": "^7.0.2",

"prettier": "^2.0.5",

"typescript": "^3.9.5"

},

“dependencies”: {

"@ babel/plugin-transform-react-jsx": "^7.13.12",

"graphql": "^15.5.0",

"graphql-request": "^3.4.0",

"imagemin-mozjpeg": "^9.0.0",

"imagemin-optipng": "^8.0.0",

"next": "^10.1.3",

"next-compose-plugins": "^2.2.0",

"next-optimized-images": "^2.6.1",

"next-seo": "^4.5.0",

"react": "^16.13.1",

"react-dom": "^16.13.1",

"react-icons": "^3.10.0",

"react-mailchimp-subscribe": "^2.1.0",

"react-slick": "^0.26.1",

"resize-observer-polyfill": "^1.5.1",

"styled-components": "^5.1.1",

"styled-media-query": "^2.1.2",

"webp-loader": "^0.6.0"

}

}

Here are the logs:

3:10:28 PM: Waiting for other deploys from your team to complete
3:11:38 PM: Build ready to start
3:11:40 PM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
3:11:40 PM: build-image tag: v3.7.1
3:11:40 PM: buildbot version: 7fc984a362cd14f20b9e1035319a807cc7d7051d
3:11:40 PM: Building without cache
3:11:40 PM: Starting to prepare the repo for build
3:11:41 PM: No cached dependencies found. Cloning fresh repo
3:11:41 PM: git clone https://github.com/jrmaiafs/landing-page-react
3:11:42 PM: Preparing Git Reference refs/heads/strapi_api
3:11:43 PM: Starting build script
3:11:43 PM: Installing dependencies
3:11:43 PM: Python version set to 2.7
3:11:45 PM: v12.18.0 is already installed.
3:11:46 PM: Now using node v12.18.0 (npm v6.14.4)
3:11:46 PM: Started restoring cached build plugins
3:11:46 PM: Finished restoring cached build plugins
3:11:46 PM: Attempting ruby version 2.7.1, read from environment
3:11:47 PM: Using ruby version 2.7.1
3:11:48 PM: Using PHP version 5.6
3:11:48 PM: Started restoring cached yarn cache
3:11:48 PM: Finished restoring cached yarn cache
3:11:48 PM: Installing yarn at version 1.22.4
3:11:48 PM: Installing Yarn!
3:11:48 PM: > Downloading tarball…
3:11:48 PM: [1/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz → /tmp/yarn.tar.gz.dxUw6BywM6
3:11:48 PM: % Total % Received % Xferd Average Speed Time Time Time Current
3:11:48 PM: Dload Upload Total Spent Left Speed
3:11:48 PM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
3:11:48 PM: 100 79 100 79 0 0 256 0 --:–:-- --:–:-- --:–:-- 257
3:11:48 PM: 100 93 100 93 0 0 174 0 --:–:-- --:–:-- --:–:-- 174
3:11:48 PM: 100 625 100 625 0 0 795 0 --:–:-- --:–:-- --:–:-- 795
3:11:49 PM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
3:11:49 PM: 100 1215k 100 1215k 0 0 1061k 0 0:00:01 0:00:01 --:–:-- 7279k
3:11:49 PM: [2/2]: https ://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz.asc → /tmp/yarn.tar.gz.dxUw6BywM6.asc
3:11:49 PM: 100 83 100 83 0 0 643 0 --:–:-- --:–:-- --:–:-- 643
3:11:49 PM: 100 97 100 97 0 0 613 0 --:–:-- --:–:-- --:–:-- 613
3:11:49 PM: 100 629 100 629 0 0 3407 0 --:–:-- --:–:-- --:–:-- 3407
3:11:49 PM: 100 1028 100 1028 0 0 5246 0 --:–:-- --:–:-- --:–:-- 5246
3:11:49 PM: > Verifying integrity…
3:11:49 PM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA
3:11:49 PM: gpg: Good signature from “Yarn Packaging yarn@dan.cx
3:11:49 PM: gpg: WARNING: This key is not certified with a trusted signature!
3:11:49 PM: gpg: There is no indication that the signature belongs to the owner.
3:11:49 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
3:11:49 PM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
3:11:49 PM: > GPG signature looks good
3:11:49 PM: > Extracting to ~/.yarn…
3:11:49 PM: > Adding to PATH... 3:11:50 PM: > Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available. 3:11:50 PM: Started restoring cached node modules 3:11:50 PM: Finished restoring cached node modules 3:11:50 PM: Installing NPM modules using Yarn version 1.22.4 3:11:50 PM: yarn install v1.22.4 3:11:50 PM: [1/4] Resolving packages... 3:11:51 PM: [2/4] Fetching packages... 3:11:59 PM: warning url-loader@1.1.2: Invalid bin field for "url-loader". 3:12:11 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module. 3:12:11 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. 3:12:11 PM: info fsevents@2.1.3: The platform "linux" is incompatible with this module. 3:12:11 PM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. 3:12:11 PM: [3/4] Linking dependencies... 3:12:11 PM: warning " > @ babel/plugin-transform-react-jsx@7.13.12" has unmet peer dependency "@ babel/core@^7.0.0-0". 3:12:11 PM: warning "@ babel/plugin-transform-react-jsx > @ babel/plugin-syntax-jsx@7.12.13" has unmet peer dependency "@ babel/core@^7.0.0-0". 3:12:11 PM: warning "next-optimized-images > file-loader@ 3.0.1" has unmet peer dependency "webpack@^4.0.0". 3:12:11 PM: warning "next-optimized-images > raw-loader@ 2.0.0" has unmet peer dependency "webpack@^4.3.0". 3:12:11 PM: warning "next-optimized-images > url-loader@1.1.2" has unmet peer dependency "webpack @^3.0.0 || ^4.0.0". 3:12:11 PM: warning " > styled-components@5.1.1" has unmet peer dependency "react-is@>= 16.8.0". 3:12:11 PM: warning " > webp-loader @ 0.6.0" has unmet peer dependency "webpack@*". 3:12:11 PM: warning " > webp-loader@ 0.6.0" has unmet peer dependency "webpack-cli@*". 3:12:11 PM: warning " > eslint-plugin-impor t@2.20.2" has incorrect peer dependency "eslint@2.x - 6.x". 3:12:21 PM: [4/4] Building fresh packages... 3:12:23 PM: Done in 32.23s. 3:12:23 PM: NPM modules installed using Yarn 3:12:23 PM: Started restoring cached go cache 3:12:23 PM: Finished restoring cached go cache 3:12:23 PM: go version go1.14.4 linux/amd64 3:12:23 PM: go version go1.14.4 linux/amd64 3:12:23 PM: Installing missing commands 3:12:23 PM: Verify run directory 3:12:25 PM: ​ 3:12:25 PM: ──────────────────────────────────────────────────────────────── 3:12:25 PM: Netlify Build 3:12:25 PM: ──────────────────────────────────────────────────────────────── 3:12:25 PM: ​ 3:12:25 PM: ❯ Version 3:12:25 PM: @netlify/build 10.2.2 3:12:25 PM: ​ 3:12:25 PM: ❯ Flags 3:12:25 PM: deployId: 606b5294263526415c43be48 3:12:25 PM: ​ 3:12:25 PM: ❯ Current directory 3:12:25 PM: /opt/build/repo 3:12:25 PM: ​ 3:12:25 PM: ❯ Config file 3:12:25 PM: No config file was defined: using default values. 3:12:25 PM: ​ 3:12:25 PM: ❯ Context 3:12:25 PM: production 3:12:25 PM: ​ 3:12:25 PM: ❯ Installing plugins 3:12:25 PM: - @ netlify/plugin-nextjs@3.0.3 3:12:47 PM: ​ 3:12:47 PM: ❯ Loading plugins 3:12:47 PM: - @ netlify/plugin-nextjs@3.0.3 from Netlify app 3:12:48 PM: ​ 3:12:48 PM: ──────────────────────────────────────────────────────────────── 3:12:48 PM: 1. onPreBuild command from @netlify/plugin-nextjs 3:12:48 PM: ──────────────────────────────────────────────────────────────── 3:12:48 PM: ​ 3:12:48 PM: info - Loaded env from /opt/build/repo/.env.production 3:12:48 PM: info - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5 3:12:49 PM: Your next.config.js must set the "target" property to one of: serverless, experimental-serverless-trace. Update the 3:12:49 PM: target property to allow this plugin to run. 3:12:49 PM: ​ 3:12:49 PM: (@ netlify/plugin-nextjs onPreBuild completed in 983ms) 3:12:49 PM: ​ 3:12:49 PM: ──────────────────────────────────────────────────────────────── 3:12:49 PM: 2. Build command from Netlify app 3:12:49 PM: ──────────────────────────────────────────────────────────────── 3:12:49 PM: ​ 3:12:49 PM: yarn build
3:12:49 PM: yarn run v1.22.4
3:12:49 PM: $ next build
3:12:50 PM: warn - React 17.0.1 or newer will be required to leverage all of the upcoming features in Next.js 11. Read more: react-version | Next.js
3:12:50 PM: info - Using webpack 4. Reason: future.webpack5 option not enabled https: //nextjs.org/docs/messages/webpack5
3:12:51 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https ://nextjs.org/docs/messages/no-cache
3:12:51 PM: info - Checking validity of types…
3:12:59 PM: info - Creating an optimized production build…
3:13:00 PM: info - Using external babel configuration from /opt/build/repo/.babelrc
3:13:21 PM: info - Compiled successfully
3:13:21 PM: info - Collecting page data…
3:13:22 PM: info - Generating static pages (0/3)
3:13:23 PM: info - Generating static pages (3/3)
3:13:23 PM: info - Finalizing page optimization…
3:13:24 PM: Page Size First Load JS
3:13:24 PM: ┌ ● / 26.2 kB 110 kB
3:13:24 PM: ├ /_app 0 B 84.3 kB
3:13:24 PM: └ ○ /404 3.46 kB 87.7 kB
3:13:24 PM: + First Load JS shared by all 84.3 kB
3:13:24 PM: ├ chunks/71247caf95475e3ea7f9a0f8a30beb258b23d005.486836.js 21.7 kB
3:13:24 PM: ├ chunks/f6078781a05fe1bcb0902d23dbbb2662c8d200b3.fd8427.js 13 kB
3:13:24 PM: ├ chunks/framework.be12de.js 39.9 kB
3:13:24 PM: ├ chunks/main.dd1903.js 7.56 kB
3:13:24 PM: ├ chunks/pages/_app.1e6364.js 1.38 kB
3:13:24 PM: └ chunks/webpack.50bee0.js 751 B
3:13:24 PM: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
3:13:24 PM: ○ (Static) automatically rendered as static HTML (uses no initial props)
3:13:24 PM: ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
3:13:24 PM: (ISR) incremental static regeneration (uses revalidate in getStaticProps)
3:13:24 PM: Done in 34.67s.
3:13:24 PM: ​
3:13:24 PM: (build.command completed in 34.9s)
3:13:24 PM: ​
3:13:24 PM: ────────────────────────────────────────────────────────────────
3:13:24 PM: 3. onBuild command from @ netlify/plugin-nextjs
3:13:24 PM: ────────────────────────────────────────────────────────────────
3:13:24 PM: ​
3:13:24 PM: Your next.config.js must set the “target” property to one of: serverless, experimental-serverless-trace. Update the
3:13:24 PM: target property to allow this plugin to run.
3:13:24 PM: ​
3:13:24 PM: (@ netlify/plugin-nextjs onBuild completed in 4ms)
3:13:24 PM: ​
3:13:24 PM: ────────────────────────────────────────────────────────────────
3:13:24 PM: 4. Deploy site
3:13:24 PM: ────────────────────────────────────────────────────────────────
3:13:24 PM: ​
3:13:24 PM: ​
3:13:24 PM: ────────────────────────────────────────────────────────────────
3:13:24 PM: Configuration error
3:13:24 PM: ────────────────────────────────────────────────────────────────
3:13:24 PM: ​
3:13:24 PM: Error message
3:13:24 PM: Deploy did not succeed: Deploy directory ‘out’ does not exist
3:13:24 PM: ​
3:13:24 PM: Resolved config
3:13:24 PM: build:
3:13:24 PM: command: yarn build
3:13:24 PM: commandOrigin: ui
3:13:24 PM: publish: /opt/build/repo/out
3:13:24 PM: plugins:
3:13:24 PM: - inputs: {}
3:13:24 PM: origin: ui
3:13:24 PM: package: ‘@ netlify/plugin-nextjs’
3:13:24 PM: Caching artifacts
3:13:24 PM: Started saving node modules
3:13:24 PM: Finished saving node modules
3:13:24 PM: Started saving build plugins
3:13:24 PM: Finished saving build plugins
3:13:24 PM: Started saving yarn cache
3:13:24 PM: Finished saving yarn cache
3:13:24 PM: Started saving pip cache
3:13:24 PM: Finished saving pip cache
3:13:24 PM: Started saving emacs cask dependencies
3:13:24 PM: Finished saving emacs cask dependencies
3:13:24 PM: Started saving maven dependencies
3:13:24 PM: Finished saving maven dependencies
3:13:24 PM: Started saving boot dependencies
3:13:24 PM: Finished saving boot dependencies
3:13:24 PM: Started saving rust rustup cache
3:13:24 PM: Finished saving rust rustup cache
3:13:24 PM: Started saving go dependencies
3:13:24 PM: Finished saving go dependencies
3:13:27 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:13:27 PM: Failing build: Failed to build site
3:13:27 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
3:13:27 PM: Finished processing build request in 1m46.92270767s

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

can someone help me?

hi there, sure! did you read the guides above? your error indicates that the directory out does not exist. the short answer is that you can either add that directory to your repo, or, you can change your build settings to point to a different directory :slight_smile:

Thanks for responding, sorry for the delay, the internet here sometimes takes many hours to return. Okay. I created the out folder in my repo. I managed to deploy it, but when I open it to see the preview it gives a page not found. I’m suspecting that it has something to do with this part of the log:
6:45:10 PM: Starting to deploy site from ‘out’
6:45:10 PM: Creating deploy tree
6:45:10 PM: Creating deploy upload records
6:45:10 PM: 0 new files to upload
6:45:10 PM: 0 new functions to upload
6:45:10 PM: Site deploy was successfully initiated
.
I have a doubt, why create an empty out folder in my repository?

As I understand it netlify was in this folder trying to search for the files on the page and found nothing.

Ditch the out folder and try this:

like this?:

“scripts”: {
“test”: “jest --passWithNoTests”,
“lint”: “eslint src”,
“dev”: “next”,
“start”: “next start”,
“build”: “npm run export”,
“export”: “next build && next export”,
“deploy”: “yarn build && next export”,
“format”: “prettier --ignore-path .gitignore --write “**/*.+(js|json)””
},

thank you so much. it worked really well! :pray: :smiley:

1 Like