I am receiving the following build error when doing "vercel build" and have tried changing the vercel directory, setting CI to false, checked for the fetch failed type error. I have removed and reinstalled the node modules. I think it may be that vercel cant access some files. I am connected to the sanity.io CMS backend using fetch and updating the website via their CMS.
https://github.com/Jameshunter1/Portfolio
C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james>vercel build
Vercel CLI 28.4.4
WARNING: You should not upload the .next
directory.
Installing dependencies...
up to date in 2s
216 packages are looking for funding
run npm fund
for details
Detected Next.js version: 12.3.0
Detected package-lock.json
generated by npm 7+...
Running "npm run build"
portfolio-james@0.1.0 build next build
info - Loaded env from C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james.env.local
info - Linting and checking validity of types
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
[== ] info - Generating static pages (2/3)(node:8760) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use node --trace-warnings ...
to show where the warning was created)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error TypeError: fetch failed at Object.processResponse (node:internal/deps/undici/undici:6254:34) at node:internal/deps/undici/undici:6579:42 at node:internal/process/task_queues:140:7 at AsyncResource.runInAsyncScope (node:async_hooks:203:9) at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) info - Generating static pages (3/3)
Build error occurred Error: Export encountered errors on following paths: / at C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james\node_modules\next\dist\export\index.js:394:19 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Span.traceAsyncFn (C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james\node_modules\next\dist\trace\trace.js:79:20) at async C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james\node_modules\next\dist\build\index.js:1168:21 at async Span.traceAsyncFn (C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james\node_modules\next\dist\trace\trace.js:79:20) at async C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james\node_modules\next\dist\build\index.js:1044:17 at async Span.traceAsyncFn (C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james\node_modules\next\dist\trace\trace.js:79:20) at async Object.build [as default] (C:\Users\James\OneDrive\Desktop\Web Dev Projects\portfolio-james\node_modules\next\dist\build\index.js:65:29) Error: Command "npm run build" exited with 1
**package.json**
{
"name": "portfolio-james",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@heroicons/react": "^2.0.11",
"@portabletext/react": "^1.0.6",
"@sanity/image-url": "^1.0.1",
"firebase": "^9.10.0",
"framer-motion": "^7.3.5",
"next": "^12.3.0",
"next-sanity": "^0.8.4",
"react": "^18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.36.0",
"react-simple-typewriter": "^4.0.2",
"react-social-icons": "^5.14.0"
},
"devDependencies": {
"@types/node": "18.7.18",
"@types/react": "18.0.20",
"@types/react-dom": "18.0.6",
"autoprefixer": "^10.4.11",
"eslint": "8.23.1",
"eslint-config-next": "12.3.0",
"postcss": "^8.4.16",
"tailwind-scrollbar": "^2.0.1",
"tailwindcss": "^3.1.8",
"typescript": "4.8.3"
}
}
**/.vercel/builds.json/**
**"//": "This file was generated by the `vercel build` command. It is not part of the Build
Output API.",
"target": "preview",
"argv": [
"C:\\Program Files\\nodejs\\node.exe",
"C:\\Users\\James\\AppData\\Roaming\\npm\\node_modules\\vercel\\dist\\index.js",
"build"
],
"builds": [
{
"require": "@vercel/next",
"requirePath": "C:\\Users\\James\\AppData\\Roaming\\npm\\node_modules\\vercel\\node_modules\\@vercel\\next\\dist\\index",
"apiVersion": 2,
"src": "package.json",
"use": "@vercel/next",
"config": {
"zeroConfig": true,
"framework": "nextjs"
},
"error": {
"name": "Error",
"stack": "Error: Command \"npm run build\" exited with 1\n at ChildProcess.<anonymous> (C:\\Users\\James\\AppData\\Roaming\\npm\\node_modules\\vercel\\node_modules\\@vercel\\build-utils\\dist\\index.js:30910:20)\n at ChildProcess.emit (node:events:513:28)\n at ChildProcess.emit (node:domain:482:12)\n at ChildProcess.cp.emit (C:\\Users\\James\\AppData\\Roaming\\npm\\node_modules\\vercel\\node_modules\\@vercel\\build-utils\\dist\\index.js:17913:29)\n at maybeClose (node:internal/child_process:1091:16)\n at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)",
"message": "Command \"npm run build\" exited with 1",
"hideStackTrace": true,
"code": "BUILD_UTILS_SPAWN_1"
}
}
],
"error": {
"name": "Error",
"stack": "Error: Command \"npm run build\" exited with 1\n at ChildProcess.<anonymous> (C:\\Users\\James\\AppData\\Roaming\\npm\\node_modules\\vercel\\node_modules\\@vercel\\build-utils\\dist\\index.js:30910:20)\n at ChildProcess.emit (node:events:513:28)\n at ChildProcess.emit (node:domain:482:12)\n at ChildProcess.cp.emit (C:\\Users\\James\\AppData\\Roaming\\npm\\node_modules\\vercel\\node_modules\\@vercel\\build-utils\\dist\\index.js:17913:29)\n at maybeClose (node:internal/child_process:1091:16)\n at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)",
"message": "Command \"npm run build\" exited with 1",
"hideStackTrace": true,
"code": "BUILD_UTILS_SPAWN_1"
}
}**