Site-name : ouigroup-client-dashboard-stg
I’ve setup a NX repository with a NextJS app inside. I tried to configure a Gitlab pipeline for the automated deployment process but I failed so far.
I tried to deploy locally and tried to get through the problem but I also failed, I get the error :
“Could not find a production build in the ‘/builds/ouigroup/client-dashboard/dist/apps/front-nextjs/.next’ directory. Try building your app with ‘next build’ before starting the production server. Could not find a production build | Next.js”
I have a rather short netlify.toml
[build]
publish = "dist/apps/front-nextjs/.next"
command = "nx build front-nextjs"
[[plugins]]
package = "@netlify/plugin-nextjs"
I used the latest netlify/plugin-nextjs
and tried the 4.25
as mentionned in a previous topic but it doesn’t work either.
Build logs :
8:59:19 AM: build-image version: 1ca34a93198b041e44214013884c57d146a23fed (focal)
8:59:19 AM: build-image tag: v4.16.4
8:59:19 AM: buildbot version: 2577a19e1559072eeb7a6727cec389b63b90401c
8:59:19 AM: Fetching cached dependencies
8:59:19 AM: Failed to fetch cache, continuing with build
8:59:19 AM: Starting to prepare the repo for build
8:59:19 AM: No cached dependencies found. Cloning fresh repo
8:59:19 AM: git clone --filter=blob:none --no-checkout git@gitlab.com:ouigroup/client-dashboard
8:59:20 AM: Preparing Git Reference refs/heads/stg
8:59:22 AM: Parsing package.json dependencies
8:59:23 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'nx build front-nextjs' versus 'yarn build' in the Netlify UI
8:59:23 AM: Starting build script
8:59:23 AM: Installing dependencies
8:59:23 AM: Python version set to 2.7
8:59:23 AM: v16.19.0 is already installed.
8:59:24 AM: Now using node v16.19.0 (npm v8.19.3)
8:59:24 AM: Enabling Node.js Corepack
8:59:24 AM: Started restoring cached build plugins
8:59:24 AM: Finished restoring cached build plugins
8:59:24 AM: Attempting Ruby version 2.7.2, read from environment
8:59:25 AM: Using Ruby version 2.7.2
8:59:25 AM: Using PHP version 8.0
8:59:25 AM: Started restoring cached corepack dependencies
8:59:25 AM: mv: cannot move '/opt/build/cache/.node/corepack' to '/opt/buildhome/.node/corepack': No such file or directory
8:59:25 AM: Finished restoring cached corepack dependencies
8:59:25 AM: Started restoring cached yarn cache
8:59:25 AM: Finished restoring cached yarn cache
8:59:26 AM: No yarn workspaces detected
8:59:26 AM: Started restoring cached node modules
8:59:26 AM: Finished restoring cached node modules
8:59:26 AM: Installing npm packages using Yarn version 1.22.19
8:59:26 AM: yarn install v1.22.19
8:59:26 AM: [1/4] Resolving packages...
8:59:26 AM: [2/4] Fetching packages...
8:59:53 AM: [3/4] Linking dependencies...
8:59:53 AM: warning "@nrwl/next > @babel/plugin-proposal-decorators@7.20.7" has unmet peer dependency "@babel/core@^7.0.0-0".
8:59:53 AM: warning "@nrwl/next > url-loader@4.1.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
8:59:53 AM: warning "@nrwl/next > @babel/plugin-proposal-decorators > @babel/helper-create-class-features-plugin@7.20.12" has unmet peer dependency "@babel/core@^7.0.0".
8:59:53 AM: warning "@nrwl/next > @babel/plugin-proposal-decorators > @babel/plugin-syntax-decorators@7.19.0" has unmet peer dependency "@babel/core@^7.0.0-0".
8:59:53 AM: warning "@nrwl/next > @nrwl/webpack > babel-loader@8.3.0" has unmet peer dependency "@babel/core@^7.0.0".
8:59:53 AM: warning " > @babel/preset-react@7.18.6" has unmet peer dependency "@babel/core@^7.0.0-0".
8:59:53 AM: warning "babel-jest > babel-preset-jest@28.1.3" has unmet peer dependency "@babel/core@^7.0.0".
8:59:53 AM: warning " > bootstrap@5.2.3" has unmet peer dependency "@popperjs/core@^2.11.6".
8:59:53 AM: warning "@nrwl/web > @nrwl/vite@15.4.5" has unmet peer dependency "vite@^4.0.1".
8:59:53 AM: warning "@nrwl/web > @nrwl/vite@15.4.5" has unmet peer dependency "vitest@^0.25.8".
8:59:53 AM: warning " > @testing-library/react-hooks@8.0.1" has incorrect peer dependency "react@^16.9.0 || ^17.0.0".
8:59:53 AM: warning " > babel-jest@28.1.1" has unmet peer dependency "@babel/core@^7.8.0".
9:00:13 AM: [4/4] Building fresh packages...
9:00:27 AM: $ husky install
9:00:27 AM: husky - Git hooks installed
9:00:27 AM: Done in 61.15s.
9:00:27 AM: npm packages installed using Yarn
9:00:27 AM: Started restoring cached go cache
9:00:27 AM: Finished restoring cached go cache
9:00:27 AM: go version go1.19.5 linux/amd64
9:00:28 AM: Detected 1 framework(s)
9:00:28 AM: "next-nx" at version "15.4.5"
9:00:28 AM: Installing missing commands
9:00:28 AM: Verify run directory
9:00:28 AM: Section completed: initializing
9:00:29 AM:
9:00:29 AM: Netlify Build
9:00:29 AM: ────────────────────────────────────────────────────────────────
9:00:29 AM:
9:00:29 AM: ❯ Version
9:00:29 AM: @netlify/build 29.5.1
9:00:29 AM:
9:00:29 AM: ❯ Flags
9:00:29 AM: baseRelDir: true
9:00:29 AM: buildId: 63d0e155f614120008b0b196
9:00:29 AM: deployId: 63d0e155f614120008b0b198
9:00:29 AM:
9:00:29 AM: ❯ Current directory
9:00:29 AM: /opt/build/repo
9:00:29 AM:
9:00:29 AM: ❯ Config file
9:00:29 AM: /opt/build/repo/netlify.toml
9:00:29 AM:
9:00:29 AM: ❯ Context
9:00:29 AM: branch-deploy
9:00:30 AM:
9:00:30 AM: ❯ Using Next.js Runtime - v4.25.0
9:00:30 AM:
9:00:30 AM: ❯ Outdated plugins
9:00:30 AM: - @netlify/plugin-nextjs@4.25.0: latest version is 4.30.1
9:00:30 AM: To upgrade this plugin, please update its version in "package.json"
9:00:31 AM:
9:00:31 AM: 1. @netlify/plugin-nextjs (onPreBuild event)
9:00:31 AM: ────────────────────────────────────────────────────────────────
9:00:31 AM:
9:00:31 AM: No Next.js cache to restore.
9:00:31 AM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
9:00:31 AM:
9:00:31 AM: (@netlify/plugin-nextjs onPreBuild completed in 18ms)
9:00:31 AM:
9:00:31 AM: 2. build.command from netlify.toml
9:00:31 AM: ────────────────────────────────────────────────────────────────
9:00:31 AM:
9:00:31 AM: $ nx build front-nextjs
9:00:32 AM: > nx run front-nextjs:build:production [remote cache]
9:00:32 AM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
9:00:32 AM: Attention: Next.js now collects completely anonymous telemetry regarding usage.
9:00:32 AM: This information is used to shape Next.js' roadmap and prioritize features.You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:https://nextjs.org/telemetry
9:00:32 AM: info - Skipping linting
9:00:32 AM: info - Checking validity of types...
9:00:32 AM: info - Creating an optimized production build...
9:00:32 AM: info - Compiled successfully
9:00:32 AM: info - Collecting page data...
9:00:32 AM: info - Generating static pages (0/4)
9:00:32 AM: info - Generating static pages (1/4)
9:00:32 AM: info - Generating static pages (2/4)
9:00:32 AM: info - Generating static pages (3/4)
9:00:32 AM: info - Generating static pages (4/4)
9:00:32 AM: info - Finalizing page optimization...
9:00:32 AM: Route (pages) Size First Load JS
9:00:32 AM: ┌ λ / 4.7 kB 233 kB
9:00:32 AM: ├ /_app 0 B 229 kB
9:00:32 AM: ├ ○ /404 181 B 229 kB
9:00:32 AM: ├ λ /api/get-challenge-detail 0 B 229 kB
9:00:32 AM: ├ λ /challenge/[challengeId] 4.76 kB 233 kB
9:00:32 AM: ├ λ /challenge/[challengeId]/rankings 5.39 kB 239 kB
9:00:32 AM: ├ λ /login 27.1 kB 261 kB
9:00:32 AM: └ λ /logout 830 B 230 kB
9:00:32 AM: + First Load JS shared by all 256 kB
9:00:32 AM: ├ chunks/framework-93435e5523790c31.js 45.4 kB
9:00:32 AM: ├ chunks/main-034306150322ded5.js 27.8 kB
9:00:32 AM: ├ chunks/pages/_app-40deb7e64d609f13.js 155 kB
9:00:32 AM: ├ chunks/webpack-f164db4954bac6ec.js 826 B
9:00:32 AM: └ css/e2301e1eec10018a.css 27.5 kB
9:00:32 AM: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
9:00:32 AM: ○ (Static) automatically rendered as static HTML (uses no initial props)
9:00:32 AM: > NX Successfully ran target build for project front-nextjs
9:00:32 AM: Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
9:00:33 AM: Nx Cloud made it possible to reuse front-nextjs: https://cloud.nx.app/runs/Pg0CsBAw5W
9:00:33 AM:
9:00:33 AM: (build.command completed in 1.4s)
9:00:33 AM:
9:00:33 AM: 3. @netlify/plugin-nextjs (onBuild event)
9:00:33 AM: ────────────────────────────────────────────────────────────────
9:00:33 AM:
9:00:33 AM: Patching /opt/build/repo/node_modules/next/dist/server/base-server.js
9:00:33 AM: Done
9:00:33 AM: Patching /opt/build/repo/node_modules/next/dist/server/next-server.js
9:00:33 AM: Done
9:00:33 AM: Moving static page files to serve from CDN...
9:00:33 AM: Moved 0 files
9:00:33 AM: Using Netlify Edge Functions for image format detection. Set env var "NEXT_DISABLE_EDGE_IMAGES=true" to disable.
9:00:33 AM: Netlify configuration property "redirects" value changed to [
9:00:33 AM: { from: '/_next/static/*', to: '/static/:splat', status: 200 },
9:00:33 AM: {
9:00:33 AM: from: '/:locale/_next/static/*',
9:00:33 AM: to: '/static/:splat',
9:00:33 AM: status: 200
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/_next/image*',
9:00:33 AM: query: { url: ':url', w: ':width', q: ':quality' },
9:00:33 AM: to: '/_ipx/w_:width,q_:quality/:url',
9:00:33 AM: status: 301
9:00:33 AM: },
9:00:33 AM: { from: '/_ipx/*', to: '/.netlify/builders/_ipx', status: 200 },
9:00:33 AM: { from: '/cache/*', to: '/404.html', status: 404, force: true },
9:00:33 AM: { from: '/server/*', to: '/404.html', status: 404, force: true },
9:00:33 AM: { from: '/serverless/*', to: '/404.html', status: 404, force: true },
9:00:33 AM: { from: '/trace', to: '/404.html', status: 404, force: true },
9:00:33 AM: { from: '/traces', to: '/404.html', status: 404, force: true },
9:00:33 AM: {
9:00:33 AM: from: '/routes-manifest.json',
9:00:33 AM: to: '/404.html',
9:00:33 AM: status: 404,
9:00:33 AM: force: true
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/build-manifest.json',
9:00:33 AM: to: '/404.html',
9:00:33 AM: status: 404,
9:00:33 AM: force: true
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/prerender-manifest.json',
9:00:33 AM: to: '/404.html',
9:00:33 AM: status: 404,
9:00:33 AM: force: true
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/react-loadable-manifest.json',
9:00:33 AM: to: '/404.html',
9:00:33 AM: status: 404,
9:00:33 AM: force: true
9:00:33 AM: },
9:00:33 AM: { from: '/BUILD_ID', to: '/404.html', status: 404, force: true },
9:00:33 AM: {
9:00:33 AM: from: '/',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: true,
9:00:33 AM: conditions: { Cookie: [Array] }
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/api',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/api/*',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/*',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: conditions: { Cookie: [Array] },
9:00:33 AM: force: true
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/_next/data/PinYGg18YSylG1QZfWD_N/fr/index.json',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/_next/data/PinYGg18YSylG1QZfWD_N/fr/login.json',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/login',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/_next/data/PinYGg18YSylG1QZfWD_N/fr/logout.json',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/logout',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/_next/data/PinYGg18YSylG1QZfWD_N/fr/challenge/:challengeId.json',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/challenge/:challengeId',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/_next/data/PinYGg18YSylG1QZfWD_N/fr/challenge/:challengeId/rankings.json',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/challenge/:challengeId/rankings',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200,
9:00:33 AM: force: false
9:00:33 AM: },
9:00:33 AM: {
9:00:33 AM: from: '/*',
9:00:33 AM: to: '/.netlify/functions/___netlify-handler',
9:00:33 AM: status: 200
9:00:33 AM: }
9:00:33 AM: ].
9:00:33 AM:
9:00:33 AM: (@netlify/plugin-nextjs onBuild completed in 58ms)
9:00:33 AM:
9:00:33 AM: 4. Functions bundling
9:00:33 AM: ────────────────────────────────────────────────────────────────
9:00:33 AM:
9:00:33 AM: Packaging Functions from .netlify/functions-internal directory:
9:00:33 AM: - ___netlify-handler/___netlify-handler.js
9:00:33 AM: - ___netlify-odb-handler/___netlify-odb-handler.js
9:00:33 AM: - _ipx/_ipx.js
9:00:33 AM:
9:00:57 AM:
9:00:57 AM: (Functions bundling completed in 24.5s)
9:00:57 AM:
9:00:57 AM: 5. Edge Functions bundling
9:00:57 AM: ────────────────────────────────────────────────────────────────
9:00:57 AM:
9:00:57 AM: Packaging Edge Functions from .netlify/edge-functions directory:
9:00:57 AM: - ipx
9:00:59 AM:
9:00:59 AM: (Edge Functions bundling completed in 1.8s)
9:00:59 AM:
9:00:59 AM: 6. @netlify/plugin-nextjs (onPostBuild event)
9:00:59 AM: ────────────────────────────────────────────────────────────────
9:00:59 AM:
9:00:59 AM: Next.js cache saved.
9:00:59 AM:
9:00:59 AM: (@netlify/plugin-nextjs onPostBuild completed in 159ms)
9:00:59 AM:
9:00:59 AM: 7. Deploy site
9:00:59 AM: ────────────────────────────────────────────────────────────────
9:00:59 AM:
9:00:59 AM: Starting to deploy site from 'dist/apps/front-nextjs/.next'
9:00:59 AM: Calculating files to upload
9:01:00 AM: 1 new files to upload
9:01:00 AM: 3 new functions to upload
9:01:07 AM: Section completed: deploying
9:01:07 AM: Site deploy was successfully initiated
9:01:07 AM:
9:01:07 AM: (Deploy site completed in 7.8s)
9:01:07 AM:
9:01:07 AM: Netlify Build Complete
9:01:07 AM: ────────────────────────────────────────────────────────────────
9:01:07 AM:
9:01:07 AM: Starting post processing
9:01:07 AM: (Netlify Build completed in 37.7s)
9:01:07 AM: Caching artifacts
9:01:07 AM: Post processing - HTML
9:01:07 AM: Started saving node modules
9:01:07 AM: Finished saving node modules
9:01:07 AM: Started saving build plugins
9:01:07 AM: Finished saving build plugins
9:01:08 AM: Post processing - header rules
9:01:07 AM: Started saving yarn cache
9:01:08 AM: Post processing - redirect rules
9:01:08 AM: Post processing done
9:01:08 AM: Section completed: postprocessing
9:01:09 AM: Site is live ✨
9:01:13 AM: Finished saving yarn cache
9:01:13 AM: Started saving pip cache
9:01:14 AM: Finished saving pip cache
9:01:14 AM: Started saving emacs cask dependencies
9:01:14 AM: Finished saving emacs cask dependencies
9:01:14 AM: Started saving maven dependencies
9:01:14 AM: Finished saving maven dependencies
9:01:14 AM: Started saving boot dependencies
9:01:14 AM: Finished saving boot dependencies
9:01:14 AM: Started saving rust rustup cache
9:01:14 AM: Finished saving rust rustup cache
9:01:14 AM: Started saving go dependencies
9:01:14 AM: Finished saving go dependencies
9:01:14 AM: Build script success
9:01:14 AM: Section completed: building
9:01:21 AM: Uploading Cache of size 1.3GB
9:01:28 AM: Section completed: cleanup
9:01:28 AM: Finished processing build request in 2m9.689s