Building with craco fails - Deploy directory 'build' does not exist

Hello, folks! faced with a problem, my projects on react + craco are not build in netlify. has anyone encountered a similar problem? everything is fine with local builds

11:06:51 AM: Installing NPM modules using NPM version 6.14.4
11:06:43 AM: Build ready to start
11:06:45 AM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
11:06:45 AM: build-image tag: v3.6.1
11:06:45 AM: buildbot version: 44655717ddf0e7bd7f856f5b1154254de54b1d80
11:06:45 AM: Fetching cached dependencies
11:06:45 AM: Failed to fetch cache, continuing with build
11:06:45 AM: Starting to prepare the repo for build
11:06:46 AM: No cached dependencies found. Cloning fresh repo
11:06:46 AM: git clone https://github.com/TimSeryakov/it-territory-test-task
11:06:46 AM: Preparing Git Reference refs/heads/master
11:06:48 AM: Starting build script
11:06:48 AM: Installing dependencies
11:06:48 AM: Python version set to 2.7
11:06:49 AM: v12.18.0 is already installed.
11:06:49 AM: Now using node v12.18.0 (npm v6.14.4)
11:06:49 AM: Started restoring cached build plugins
11:06:49 AM: Finished restoring cached build plugins
11:06:49 AM: Attempting ruby version 2.7.1, read from environment
11:06:51 AM: Using ruby version 2.7.1
11:06:51 AM: Using PHP version 5.6
11:06:51 AM: Started restoring cached node modules
11:06:51 AM: Finished restoring cached node modules
11:06:55 AM: npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
11:07:00 AM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
11:07:03 AM: npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
11:07:04 AM: npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
11:07:04 AM: npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
11:07:06 AM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
11:07:07 AM: npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
11:07:07 AM: npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
11:07:07 AM: npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
11:07:07 AM: npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
11:07:08 AM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
11:07:08 AM: npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
11:07:08 AM: npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
11:07:09 AM: npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
11:07:09 AM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
11:07:39 AM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
11:07:39 AM: > node -e "try{require('./postinstall')}catch(e){}"
11:07:39 AM: > core-js@3.8.3 postinstall /opt/build/repo/node_modules/core-js
11:07:39 AM: > node -e "try{require('./postinstall')}catch(e){}"
11:07:39 AM: > core-js-pure@3.8.3 postinstall /opt/build/repo/node_modules/core-js-pure
11:07:39 AM: > node -e "try{require('./postinstall')}catch(e){}"
11:07:39 AM: > ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
11:07:39 AM: > node ./postinstall.js
11:07:41 AM: npm notice created a lockfile as package-lock.json. You should commit this file.
11:07:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.3 (node_modules/react-scripts/node_modules/fsevents):
11:07:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:07:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
11:07:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:07:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
11:07:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:07:41 AM: npm WARN airbnb-prop-types@2.16.0 requires a peer of react@^0.14 || ^15.0.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself.
11:07:41 AM: added 1878 packages from 879 contributors and audited 1888 packages in 49.189s
11:07:42 AM: 133 packages are looking for funding
11:07:42 AM:   run `npm fund` for details
11:07:42 AM: found 0 vulnerabilities
11:07:42 AM: NPM modules installed
11:07:42 AM: Started restoring cached go cache
11:07:42 AM: Finished restoring cached go cache
11:07:43 AM: go version go1.14.4 linux/amd64
11:07:43 AM: go version go1.14.4 linux/amd64
11:07:43 AM: Installing missing commands
11:07:43 AM: Verify run directory
11:07:44 AM: ​
11:07:44 AM: ────────────────────────────────────────────────────────────────
11:07:44 AM:   Netlify Build                                                 
11:07:44 AM: ────────────────────────────────────────────────────────────────
11:07:44 AM: ​
11:07:44 AM: ❯ Version
11:07:44 AM:   @netlify/build 8.3.0
11:07:44 AM: ​
11:07:44 AM: ❯ Flags
11:07:44 AM:   deployId: 6015139334cec9e1c0e08e45
11:07:44 AM:   mode: buildbot
11:07:44 AM: ​
11:07:44 AM: ❯ Current directory
11:07:44 AM:   /opt/build/repo
11:07:44 AM: ​
11:07:44 AM: ❯ Config file
11:07:44 AM:   No config file was defined: using default values.
11:07:44 AM: ​
11:07:44 AM: ❯ Context
11:07:44 AM:   production
11:07:44 AM: ​
11:07:44 AM: ────────────────────────────────────────────────────────────────
11:07:44 AM:   1. Build command from Netlify app                             
11:07:44 AM: ────────────────────────────────────────────────────────────────
11:07:44 AM: ​
11:07:44 AM: $ npm run build
11:07:45 AM: > react-redux-typescript-tailwindcss@0.1.0 build /opt/build/repo
11:07:45 AM: > craco build
11:07:45 AM: (node:1368) UnhandledPromiseRejectionWarning: Error: Cannot find module 'tailwindcss'
11:07:45 AM: Require stack:
11:07:45 AM: - /opt/build/repo/craco.config.js
11:07:45 AM: - /opt/build/repo/node_modules/@craco/craco/lib/config.js
11:07:45 AM: - /opt/build/repo/node_modules/@craco/craco/scripts/build.js
11:07:45 AM:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
11:07:45 AM:     at Function.Module._load (internal/modules/cjs/loader.js:842:27)
11:07:45 AM:     at Module.require (internal/modules/cjs/loader.js:1026:19)
11:07:45 AM:     at require (internal/modules/cjs/helpers.js:72:18)
11:07:45 AM:     at Object.<anonymous> (/opt/build/repo/craco.config.js:5:17)
11:07:45 AM:     at Module._compile (internal/modules/cjs/loader.js:1138:30)
11:07:45 AM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
11:07:45 AM:     at Module.load (internal/modules/cjs/loader.js:986:32)
11:07:45 AM:     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
11:07:45 AM:     at Module.require (internal/modules/cjs/loader.js:1026:19)
11:07:45 AM: (node:1368) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
11:07:45 AM: (node:1368) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
11:07:45 AM: ​
11:07:45 AM: (build.command completed in 551ms)
11:07:45 AM: ​
11:07:45 AM: ────────────────────────────────────────────────────────────────
11:07:45 AM:   2. Deploy site                                                
11:07:45 AM: ────────────────────────────────────────────────────────────────
11:07:45 AM: ​
11:07:45 AM: ​
11:07:45 AM: ────────────────────────────────────────────────────────────────
11:07:45 AM:   Configuration error                                           
11:07:45 AM: ────────────────────────────────────────────────────────────────
11:07:45 AM: ​
11:07:45 AM:   Error message
11:07:45 AM:   Deploy did not succeed: Deploy directory 'build' does not exist
11:07:45 AM: ​
11:07:45 AM:   Resolved config
11:07:45 AM:   build:
11:07:45 AM:     command: npm run build
11:07:45 AM:     commandOrigin: ui
11:07:45 AM:     publish: /opt/build/repo/build
11:07:45 AM: Caching artifacts
11:07:45 AM: Started saving node modules
11:07:45 AM: Finished saving node modules
11:07:45 AM: Started saving build plugins
11:07:45 AM: Finished saving build plugins
11:07:45 AM: Started saving pip cache
11:07:45 AM: Finished saving pip cache
11:07:45 AM: Started saving emacs cask dependencies
11:07:45 AM: Finished saving emacs cask dependencies
11:07:45 AM: Started saving maven dependencies
11:07:45 AM: Finished saving maven dependencies
11:07:45 AM: Started saving boot dependencies
11:07:45 AM: Finished saving boot dependencies
11:07:45 AM: Started saving rust rustup cache
11:07:45 AM: Finished saving rust rustup cache
11:07:45 AM: Started saving go dependencies
11:07:45 AM: Finished saving go dependencies
11:07:48 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:07:48 AM: Failing build: Failed to build site
11:07:48 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
11:07:48 AM: Finished processing build request in 1m2.858598049s




{
  "name": "react-redux-typescript-tailwindcss",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@craco/craco": "^6.0.0",
    "@tailwindcss/postcss7-compat": "^2.0.2",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^26.0.15",
    "@types/node": "^12.0.0",
    "@types/react": "^16.9.53",
    "@types/react-dom": "^16.9.8",
    "@types/react-outside-click-handler": "^1.3.0",
    "@types/react-redux": "^7.1.12",
    "@types/react-router-dom": "^5.1.7",
    "@types/redux-logger": "^3.0.8",
    "@types/uuid": "^8.3.0",
    "autoprefixer": "^9",
    "axios": "^0.21.0",
    "postcss": "^7",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-movable": "^2.5.3",
    "react-outside-click-handler": "^1.3.0",
    "react-redux": "^7.2.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "react-toastify": "^6.2.0",
    "redux": "^4.0.5",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat",
    "typescript": "^4.1.3",
    "uuid": "^8.3.2"
  },
  "scripts": {
    "start": "craco start",
    "build": "craco build",
    "test": "craco test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "babel-loader": "8.1.0"
  }
}
{
  "name": "react-redux-typescript-tailwindcss",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@craco/craco": "^6.0.0",
    "@tailwindcss/postcss7-compat": "^2.0.2",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^26.0.15",
    "@types/node": "^12.0.0",
    "@types/react": "^16.9.53",
    "@types/react-dom": "^16.9.8",
    "@types/react-outside-click-handler": "^1.3.0",
    "@types/react-redux": "^7.1.12",
    "@types/react-router-dom": "^5.1.7",
    "@types/redux-logger": "^3.0.8",
    "@types/uuid": "^8.3.0",
    "autoprefixer": "^9",
    "axios": "^0.21.0",
    "postcss": "^7",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-movable": "^2.5.3",
    "react-outside-click-handler": "^1.3.0",
    "react-redux": "^7.2.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "react-toastify": "^6.2.0",
    "redux": "^4.0.5",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat",
    "typescript": "^4.1.3",
    "uuid": "^8.3.2"
  },
  "scripts": {
    "start": "craco start",
    "build": "craco build",
    "test": "craco test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "babel-loader": "8.1.0"
  }
}

I’m also suspicious of this line, but I’m not sure

It should probably be "tailwindcss": "^2.0.2",

Thank you for your participation in solving the problem. :man_shrugging: Im tried this, but unfortunately…

Failed to compile

./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
Error: PostCSS plugin tailwindcss requires PostCSS 8.Migration guide for end-users:https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users

Just like it says. You’re using PostCSS v7. Upgrade to 8.

It looks like this is my case… Project generated using CRA

image

Oh, now I see why you were having the previous setup. Try with this then: "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2".

2 Likes

wow, this solved my problem, thank you! :+1::+1: