Home
Support Forums

NEXT.js and Netlify CMS build issue

christianleighj.netlify.app

10:44:13 PM: Build ready to start
10:44:15 PM: build-image version: a6bb34428a07e7de82f4df5dfe1843fbde91f670 (focal)
10:44:15 PM: build-image tag: v4.5.1
10:44:15 PM: buildbot version: 5fcbba13ea582427a191a2461cdf691170cae5bf
10:44:15 PM: Fetching cached dependencies
10:44:15 PM: Failed to fetch cache, continuing with build
10:44:15 PM: Starting to prepare the repo for build
10:44:16 PM: No cached dependencies found. Cloning fresh repo
10:44:16 PM: git clone https://github.com/xxoutdated/christianleighj
10:44:16 PM: Preparing Git Reference refs/heads/master
10:44:17 PM: Parsing package.json dependencies
10:44:18 PM: Starting build script
10:44:18 PM: Installing dependencies
10:44:18 PM: Python version set to 2.7
10:44:19 PM: v16.13.1 is already installed.
10:44:20 PM: Now using node v16.13.1 (npm v8.1.2)
10:44:20 PM: Started restoring cached build plugins
10:44:20 PM: Finished restoring cached build plugins
10:44:20 PM: Attempting ruby version 2.7.2, read from environment
10:44:22 PM: Using ruby version 2.7.2
10:44:22 PM: Using PHP version 8.0
10:44:22 PM: Started restoring cached node modules
10:44:22 PM: Finished restoring cached node modules
10:44:22 PM: Installing NPM modules using NPM version 8.1.2
10:44:25 PM: npm WARN old lockfile
10:44:25 PM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
10:44:25 PM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
10:44:25 PM: npm WARN old lockfile
10:44:25 PM: npm WARN old lockfile This is a one-time fix-up, please be patient...
10:44:25 PM: npm WARN old lockfile
10:44:53 PM: npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
10:44:56 PM: npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
10:44:56 PM: npm WARN deprecated os-homedir@2.0.0: This is not needed anymore. Use `require('os').homedir()` instead.
10:45:02 PM: npm WARN deprecated @types/vfile-message@2.0.0: This is a stub types definition. vfile-message provides its own type definitions, so you do not need this installed.
10:45:04 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
10:45:22 PM: added 1096 packages, and audited 1097 packages in 58s
10:45:22 PM: 198 packages are looking for funding
10:45:22 PM:   run `npm fund` for details
10:45:22 PM: 15 high severity vulnerabilities
10:45:22 PM: To address issues that do not require attention, run:
10:45:22 PM:   npm audit fix
10:45:22 PM: To address all issues possible (including breaking changes), run:
10:45:22 PM:   npm audit fix --force
10:45:22 PM: Some issues need review, and may require choosing
10:45:22 PM: a different dependency.
10:45:22 PM: Run `npm audit` for details.
10:45:22 PM: NPM modules installed
10:45:22 PM: Started restoring cached go cache
10:45:22 PM: Finished restoring cached go cache
10:45:22 PM: go version go1.16.5 linux/amd64
10:45:22 PM: go version go1.16.5 linux/amd64
10:45:22 PM: Installing missing commands
10:45:22 PM: Verify run directory
10:45:24 PM: ​
10:45:24 PM: ────────────────────────────────────────────────────────────────
10:45:24 PM:   Netlify Build                                                 
10:45:24 PM: ────────────────────────────────────────────────────────────────
10:45:24 PM: ​
10:45:24 PM: ❯ Version
10:45:24 PM:   @netlify/build 25.0.3
10:45:24 PM: ​
10:45:24 PM: ❯ Flags
10:45:24 PM:   baseRelDir: true
10:45:24 PM:   buildId: 61bf68657d58480007a64007
10:45:24 PM:   deployId: 61bf68657d58480007a64009
10:45:25 PM: ​
10:45:25 PM: ❯ Current directory
10:45:25 PM:   /opt/build/repo
10:45:25 PM: ​
10:45:25 PM: ❯ Config file
10:45:25 PM:   /opt/build/repo/netlify.toml
10:45:25 PM: ​
10:45:25 PM: ❯ Context
10:45:25 PM:   production
10:45:25 PM: ​
10:45:25 PM: ❯ Loading plugins
10:45:25 PM:    - @netlify/plugin-nextjs@4.1.0 from netlify.toml and package.json
10:45:27 PM: ​
10:45:27 PM: ────────────────────────────────────────────────────────────────
10:45:27 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
10:45:27 PM: ────────────────────────────────────────────────────────────────
10:45:27 PM: ​
10:45:27 PM: No Next.js cache to restore.
10:45:27 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
10:45:27 PM: ​
10:45:27 PM: (@netlify/plugin-nextjs onPreBuild completed in 37ms)
10:45:27 PM: ​
10:45:27 PM: ────────────────────────────────────────────────────────────────
10:45:27 PM:   2. build.command from netlify.toml                            
10:45:27 PM: ────────────────────────────────────────────────────────────────
10:45:27 PM: ​
10:45:27 PM: $ CI= next build
10:45:28 PM: info  - Loaded env from /opt/build/repo/.env
10:45:28 PM: info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
10:45:28 PM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
10:45:28 PM: info  - Checking validity of types...
10:45:29 PM: error - ESLint must be installed in order to run during builds: yarn add --dev eslint
10:45:29 PM: info  - Creating an optimized production build...
10:46:54 PM: warn  - Compiled with warnings
10:46:54 PM: ./pages/_document.js
10:46:54 PM: Attempted import error: 'Script' is not exported from 'next/document' (imported as 'Script').
10:46:54 PM: ./pages/_document.js
10:46:54 PM: Attempted import error: 'Script' is not exported from 'next/document' (imported as 'Script').
10:46:54 PM: ./pages/_document.js
10:46:54 PM: Attempted import error: 'Script' is not exported from 'next/document' (imported as 'Script').
10:46:54 PM: ./pages/_document.js
10:46:54 PM: Attempted import error: 'Script' is not exported from 'next/document' (imported as 'Script').
10:46:54 PM: ./pages/_document.js
10:46:54 PM: Attempted import error: 'Script' is not exported from 'next/document' (imported as 'Script').
10:46:54 PM: ./pages/_document.js
10:46:54 PM: Attempted import error: 'Script' is not exported from 'next/document' (imported as 'Script').
10:46:54 PM: info  - Collecting page data...
10:46:55 PM: > Build error occurred
10:46:55 PM: Error: ENOENT: no such file or directory, scandir '/opt/build/repo/content/pages'
10:46:55 PM:     at Object.readdirSync (node:fs:1390:3)
10:46:55 PM:     at getAllPostIds (/opt/build/repo/.next/server/chunks/400.js:57:63)
10:46:55 PM:     at getStaticPaths (/opt/build/repo/.next/server/pages/projects/[id].js:129:54)
10:46:55 PM:     at buildStaticPaths (/opt/build/repo/node_modules/next/dist/build/utils.js:472:37)
10:46:55 PM:     at /opt/build/repo/node_modules/next/dist/build/utils.js:615:125
10:46:55 PM:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
10:46:55 PM:     at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/telemetry/trace/trace.js:60:20) {
10:46:55 PM:   type: 'Error',
10:46:55 PM:   errno: -2,
10:46:55 PM:   syscall: 'scandir',
10:46:55 PM:   code: 'ENOENT',
10:46:55 PM:   path: '/opt/build/repo/content/pages'
10:46:55 PM: }
10:46:55 PM: ​
10:46:55 PM: ────────────────────────────────────────────────────────────────
10:46:55 PM:   "build.command" failed                                        
10:46:55 PM: ────────────────────────────────────────────────────────────────
10:46:55 PM: ​
10:46:55 PM:   Error message
10:46:55 PM:   Command failed with exit code 1: CI= next build
10:46:55 PM: ​
10:46:55 PM:   Error location
10:46:55 PM:   In build.command from netlify.toml:
10:46:55 PM:   CI= next build
10:46:55 PM: ​
10:46:55 PM:   Resolved config
10:46:55 PM:   build:
10:46:55 PM:     command: CI= next build
10:46:55 PM:     commandOrigin: config
10:46:55 PM:     environment:
10:46:55 PM:       - CI
10:46:55 PM:       - NEXT_PRIVATE_TARGET
10:46:55 PM:     publish: /opt/build/repo/.next
10:46:55 PM:     publishOrigin: config
10:46:55 PM:   plugins:
10:46:55 PM:     - inputs: {}
10:46:55 PM:       origin: config
10:46:55 PM:       package: '@netlify/plugin-nextjs'
10:46:55 PM: Caching artifacts
10:46:55 PM: Started saving node modules
10:46:55 PM: Finished saving node modules
10:46:55 PM: Started saving build plugins
10:46:55 PM: Finished saving build plugins
10:46:55 PM: Started saving pip cache
10:46:55 PM: Finished saving pip cache
10:46:55 PM: Started saving emacs cask dependencies
10:46:55 PM: Finished saving emacs cask dependencies
10:46:55 PM: Started saving maven dependencies
10:46:55 PM: Finished saving maven dependencies
10:46:55 PM: Started saving boot dependencies
10:46:55 PM: Finished saving boot dependencies
10:46:55 PM: Started saving rust rustup cache
10:46:55 PM: Finished saving rust rustup cache
10:46:55 PM: Started saving go dependencies
10:46:55 PM: Finished saving go dependencies
10:46:58 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:46:58 PM: Creating deploy upload records
10:46:58 PM: Failing build: Failed to build site
10:46:58 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
10:46:58 PM: Finished processing build request in 2m43.10396178s

I have been trying for hours and I cant figure out the issue while building my app I have tried almost all the possible solution I got and cant figure out whats wrong if anyone would be kind enough to help would mean a lot to me!
Kinda my first time working on a react app.

CLOSE this please i found the issue