PLEASE help us help you by writing a good post!
Hi,i have soem serious problems i dont know what to try anymore i tryed every single thing that i saw on google to fix it but i cant I NEED HELP
website name : graceful-muffin-7c27ac
- we need to know your netlify site name. Example:
gifted-antelope-58b104.netlify.app
- DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
- Build problems? Link or paste the FULL build log & build settings screenshot
The better the post - the faster the answer.
I see you have already opened a thread on this topic @blendemini
https://answers.netlify.com/t/build-command-failed-command-failed-with-exit-code-254-npm-run-build-https-ntl-fyi-exit-code-254/89420
Have you tried the solution offered by @Melvin?
Also, please do not post screenshots of build errors/logs. It is impossible to debug from a screenshot. Either share the link to the build log or paste the contents of the log here inside a Preformatted text block.
I tried,it doesnt work still the same problem,website is : graceful-muffin-7c27ac.netlify.app
5:42:40 AM: build-image version: f0de447600c93198b2eef6ed4ec8e338d9c0582c (focal)
5:42:40 AM: buildbot version: f0de447600c93198b2eef6ed4ec8e338d9c0582c
5:42:41 AM: Fetching cached dependencies
5:42:41 AM: Failed to fetch cache, continuing with build
5:42:41 AM: Starting to prepare the repo for build
5:42:41 AM: No cached dependencies found. Cloning fresh repo
5:42:41 AM: git clone --filter=blob:none git@github.com:BlendEmini/portfolio-next
5:42:42 AM: Preparing Git Reference refs/heads/main
5:42:43 AM: Parsing package.json dependencies
5:42:44 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: ‘netlify/functions’ versus ‘netlify\functions’ in the Netlify UI
5:42:44 AM: Different build command detected, going to use the one specified in the Netlify configuration file: ‘next build’ versus ‘npm run build’ in the Netlify UI
5:42:44 AM: Starting to install dependencies
5:42:44 AM: Using PHP version 8.0
5:42:44 AM: Python version set to 3.8
5:42:44 AM: Attempting Ruby version 2.7.2, read from environment
5:42:45 AM: Using Ruby version 2.7.2
5:42:46 AM: v16.20.0 is already installed.
5:42:46 AM: Now using node v16.20.0 (npm v8.19.4)
5:42:46 AM: Enabling Node.js Corepack
5:42:46 AM: Started restoring cached build plugins
5:42:46 AM: Finished restoring cached build plugins
5:42:46 AM: Started restoring cached corepack dependencies
5:42:46 AM: Finished restoring cached corepack dependencies
5:42:46 AM: No npm workspaces detected
5:42:46 AM: Started restoring cached node modules
5:42:46 AM: Finished restoring cached node modules
5:42:47 AM: Installing npm packages using npm version 8.19.4
5:42:49 AM: npm WARN deprecated prefixer@0.0.3: Deprecated
5:42:49 AM: npm WARN deprecated dommatrix@1.0.3: dommatrix is no longer maintained. Please use @thednp/dommatrix.
5:42:55 AM: added 284 packages, and audited 285 packages in 8s
5:42:55 AM: 53 packages are looking for funding
5:42:55 AM: run npm fund
for details
5:42:55 AM: 5 critical severity vulnerabilities
5:42:55 AM: Some issues need review, and may require choosing
5:42:55 AM: a different dependency.
5:42:55 AM: Run npm audit
for details.
5:42:55 AM: npm packages installed
5:42:55 AM: Started restoring cached go cache
5:42:55 AM: Finished restoring cached go cache
5:42:55 AM: Installing Go version 1.19.5 (requested 1.19.5)
5:43:00 AM: go version go1.19.5 linux/amd64
5:43:00 AM: Install dependencies script success
5:43:00 AM: Starting build script
5:43:01 AM: Using stage install dependencies
5:43:01 AM: Detected 1 framework(s)
5:43:01 AM: “next” at version “13.2.4”
5:43:01 AM: Section completed: initializing
5:43:03 AM:
5:43:03 AM: Netlify Build
5:43:03 AM: ────────────────────────────────────────────────────────────────
5:43:03 AM:
5:43:03 AM: ❯ Version
5:43:03 AM: @netlify/build 29.9.0
5:43:03 AM:
5:43:03 AM: ❯ Flags
5:43:03 AM: baseRelDir: true
5:43:03 AM: buildId: 642e3f857f41920007e2c5d7
5:43:03 AM: deployId: 642e3f857f41920007e2c5d9
5:43:03 AM:
5:43:03 AM: ❯ Current directory
5:43:03 AM: /opt/build/repo
5:43:03 AM:
5:43:03 AM: ❯ Config file
5:43:03 AM: /opt/build/repo/netlify.toml
5:43:03 AM:
5:43:03 AM: ❯ Context
5:43:03 AM: production
5:43:03 AM:
5:43:03 AM: ❯ Using Next.js Runtime - v4.33.0
5:43:04 AM:
5:43:04 AM: 1. @netlify/plugin-nextjs (onPreBuild event)
5:43:04 AM: ────────────────────────────────────────────────────────────────
5:43:04 AM:
5:43:04 AM: No Next.js cache to restore.
5:43:04 AM: Netlify configuration property “build.environment.NEXT_PRIVATE_TARGET” value changed.
5:43:04 AM:
5:43:04 AM: (@netlify/plugin-nextjs onPreBuild completed in 21ms)
5:43:04 AM:
5:43:04 AM: 2. build.command from netlify.toml
5:43:04 AM: ────────────────────────────────────────────────────────────────
5:43:04 AM:
5:43:04 AM: $ next build
5:43:05 AM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: no-cache | Next.js
5:43:05 AM: info - Linting and checking validity of types…
5:43:05 AM: info - Creating an optimized production build…
5:43:10 AM: info - Compiled successfully
5:43:10 AM: info - Collecting page data…
5:43:16 AM: info - Generating static pages (0/3)
5:43:17 AM: TypeError: c.props.href.startsWith is not a function
5:43:17 AM: at /opt/build/repo/node_modules/next/dist/shared/lib/head.js:123:43
5:43:17 AM: at Array.some ()
5:43:17 AM: at /opt/build/repo/node_modules/next/dist/shared/lib/head.js:123:15
5:43:17 AM: at Array.map ()
5:43:17 AM: at reduceComponents (/opt/build/repo/node_modules/next/dist/shared/lib/head.js:116:140)
5:43:17 AM: at emitChange (/opt/build/repo/node_modules/next/dist/shared/lib/side-effect.js:13:36)
5:43:17 AM: at SideEffect (/opt/build/repo/node_modules/next/dist/shared/lib/side-effect.js:19:9)
5:43:17 AM: at Wc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
5:43:17 AM: at Zc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
5:43:17 AM: at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
5:43:17 AM: Error occurred prerendering page “/”. Read more: prerender-error | Next.js
5:43:17 AM: TypeError: c.props.href.startsWith is not a function
5:43:17 AM: at /opt/build/repo/node_modules/next/dist/shared/lib/head.js:123:43
5:43:17 AM: at Array.some ()
5:43:17 AM: at /opt/build/repo/node_modules/next/dist/shared/lib/head.js:123:15
5:43:17 AM: at Array.map ()
5:43:17 AM: at reduceComponents (/opt/build/repo/node_modules/next/dist/shared/lib/head.js:116:140)
5:43:17 AM: at emitChange (/opt/build/repo/node_modules/next/dist/shared/lib/side-effect.js:13:36)
5:43:17 AM: at SideEffect (/opt/build/repo/node_modules/next/dist/shared/lib/side-effect.js:19:9)
5:43:17 AM: at Wc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
5:43:17 AM: at Zc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
5:43:17 AM: at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
5:43:17 AM: info - Generating static pages (3/3)
5:43:17 AM: > Build error occurred
5:43:17 AM: Error: Export encountered errors on following paths:
5:43:17 AM: /
5:43:17 AM: at /opt/build/repo/node_modules/next/dist/export/index.js:425:19
5:43:17 AM: at processTicksAndRejections (node:internal/process/task_queues:96:5)
5:43:17 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
5:43:17 AM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1422:21
5:43:17 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
5:43:17 AM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1280:17
5:43:17 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
5:43:17 AM: at async Object.build [as default] (/opt/build/repo/node_modules/next/dist/build/index.js:73:29)
5:43:17 AM:
5:43:17 AM: “build.command” failed
5:43:19 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
5:43:17 AM: ────────────────────────────────────────────────────────────────
5:43:17 AM:
5:43:17 AM: Error message
5:43:17 AM: Command failed with exit code 1: next build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
5:43:17 AM:
5:43:17 AM: Error location
5:43:17 AM: In build.command from netlify.toml:
5:43:17 AM: next build
5:43:17 AM:
5:43:17 AM: Resolved config
5:43:17 AM: build:
5:43:17 AM: command: next build
5:43:17 AM: commandOrigin: config
5:43:17 AM: environment:
5:43:17 AM: - NEXT_PRIVATE_TARGET
5:43:17 AM: publish: /opt/build/repo/.next
5:43:17 AM: publishOrigin: config
5:43:17 AM: functionsDirectory: /opt/build/repo/netlify/functions
5:43:17 AM: plugins:
5:43:17 AM: - inputs: {}
5:43:17 AM: origin: ui
5:43:17 AM: package: ‘@netlify/plugin-nextjs’
5:43:18 AM: Caching artifacts
5:43:18 AM: Started saving node modules
5:43:18 AM: Finished saving node modules
5:43:18 AM: Started saving build plugins
5:43:18 AM: Finished saving build plugins
5:43:18 AM: Started saving corepack cache
5:43:18 AM: Finished saving corepack cache
5:43:18 AM: Started saving pip cache
5:43:18 AM: Finished saving pip cache
5:43:18 AM: Started saving emacs cask dependencies
5:43:18 AM: Finished saving emacs cask dependencies
5:43:18 AM: Started saving maven dependencies
5:43:18 AM: Finished saving maven dependencies
5:43:18 AM: Started saving boot dependencies
5:43:18 AM: Finished saving boot dependencies
5:43:18 AM: Started saving rust rustup cache
5:43:18 AM: Finished saving rust rustup cache
5:43:18 AM: Started saving go dependencies
5:43:18 AM: Finished saving go dependencies
5:43:18 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:43:18 AM: Failing build: Failed to build site
5:43:19 AM: Finished processing build request in 38.247s
here it is the error build log
This is the first error:
startsWith
is a String
prototype only. So c.props.href
isn’t a string. Possibly is it undefined
or null
.
Have you tried building locally? Does the same error occur?
yes locally builds without any problem
I have cloned your repository and run npm run build
. I received the same error:
Creating an optimized production build ...TypeError: c.props.href.startsWith is not a function
Also when running npm run dev
I see the following
Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="https://fonts.googleapis.com/css2?family=Acme&family=Architects+Daughter&family=DM+Sans:ital,wght@0,400;0,500;0,700;1,500&family=Manrope:wght@300;400;500;600;700;800&family=Pacifico&family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,600&family=Roboto+Slab:wght@400;600;900&display=swap"). Use Document instead. See more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component Warning: Invalid value for prop
href on <link> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM. For details, see https://reactjs.org/link/attribute-behavior
This suggests it is nothing to do with Netlify.
To solve this I followed the documentation provided in the error.
-
Move the <link rel="stylesheet" href="https://fonts.googleapis.com/css2..."/>
inside the <Head>
of Document
export default function Document() {
return (
<Html lang="en">
<Head>
<link
href="https://fonts.googleapis.com/css2?family=Acme&family=Architects+Daughter&family=DM+Sans:ital,wght@0,400;0,500;0,700;1,500&family=Manrope:wght@300;400;500;600;700;800&family=Pacifico&family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,600&family=Roboto+Slab:wght@400;600;900&display=swap"
rel="stylesheet"
/>
</Head>
{/* Rest of code */}
)
}
-
Remove the <link rel="icon" href={FaSmileBeam} />
as I don’t believe it is possible to use such an icon in this manner.
Once doing this, the project successfully built locally without errors.
YEEEEYYYYYYY.IT WORKS NOWWW.This was my first project with next.js,i usually work with react.THANK YOU SO MUCH 