I have trouble with deploying my react app on netlify.
Here are my error logs :
12:07:45 AM: build-image version: b99b04bce77f7c739cbd5eebb242ff3ddb54ba7b (focal)
12:07:45 AM: buildbot version: b99b04bce77f7c739cbd5eebb242ff3ddb54ba7b
12:07:45 AM: Fetching cached dependencies
12:07:45 AM: Failed to fetch cache, continuing with build
12:07:45 AM: Starting to prepare the repo for build
12:07:45 AM: No cached dependencies found. Cloning fresh repo
12:07:45 AM: git clone --filter=blob:none https://github.com/Adipure/portfolio2023
12:07:46 AM: Preparing Git Reference refs/heads/main
12:07:46 AM: Parsing package.json dependencies
12:07:48 AM: Starting to install dependencies
12:07:48 AM: v16.19.1 is already installed.
12:07:49 AM: Now using node v16.19.1 (npm v8.19.3)
12:07:49 AM: Enabling Node.js Corepack
12:07:49 AM: Started restoring cached build plugins
12:07:49 AM: Finished restoring cached build plugins
12:07:49 AM: Started restoring cached corepack dependencies
12:07:49 AM: Finished restoring cached corepack dependencies
12:07:49 AM: No npm workspaces detected
12:07:49 AM: Started restoring cached node modules
12:07:49 AM: Finished restoring cached node modules
12:07:49 AM: Installing npm packages using npm version 8.19.3
12:07:53 AM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
12:07:53 AM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
12:07:53 AM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
12:07:56 AM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
12:07:56 AM: npm WARN deprecated emailjs-com@3.2.0: The SDK name changed to @emailjs/browser
12:08:02 AM: added 1486 packages, and audited 1487 packages in 12s
12:08:02 AM: 228 packages are looking for funding
12:08:02 AM: run `npm fund` for details
12:08:02 AM: 8 high severity vulnerabilities
12:08:02 AM: To address issues that do not require attention, run:
12:08:02 AM: npm audit fix
12:08:02 AM: To address all issues (including breaking changes), run:
12:08:02 AM: npm audit fix --force
12:08:02 AM: Run `npm audit` for details.
12:08:02 AM: npm packages installed
12:08:02 AM: Python version set to 3.8
12:08:02 AM: Started restoring cached go cache
12:08:02 AM: Finished restoring cached go cache
12:08:02 AM: Installing Go version 1.19.5 (requested 1.19.5)
12:08:07 AM: go version go1.19.5 linux/amd64
12:08:07 AM: Using PHP version 8.0
12:08:08 AM: Attempting Ruby version 2.7.2, read from environment
12:08:09 AM: Using Ruby version 2.7.2
12:08:10 AM: Install dependencies script success
12:08:10 AM: Starting build script
12:08:10 AM: Using stage install dependencies
12:08:11 AM: Detected 1 framework(s)
12:08:11 AM: "create-react-app" at version "5.0.1"
12:08:11 AM: Section completed: initializing
12:08:13 AM: β
12:08:13 AM: Netlify Build
12:08:13 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:08:13 AM: β
12:08:13 AM: β― Version
12:08:13 AM: @netlify/build 29.8.0
12:08:13 AM: β
12:08:13 AM: β― Flags
12:08:13 AM: baseRelDir: true
12:08:13 AM: buildId: 6423e3bf6dac1364b5811780
12:08:13 AM: deployId: 6423e3bf6dac1364b5811782
12:08:13 AM: β
12:08:13 AM: β― Current directory
12:08:13 AM: /opt/build/repo
12:08:13 AM: β
12:08:13 AM: β― Config file
12:08:13 AM: No config file was defined: using default values.
12:08:13 AM: β
12:08:13 AM: β― Context
12:08:13 AM: production
12:08:13 AM: β
12:08:13 AM: 1. Build command from Netlify app
12:08:13 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:08:13 AM: β
12:08:13 AM: $ npm run build
12:08:13 AM: > react-portfolio-2022@0.1.0 build
12:08:13 AM: > react-scripts build
12:08:14 AM: Creating an optimized production build...
12:08:44 AM:
12:08:44 AM: Treating warnings as errors because process.env.CI = true.
12:08:44 AM: Most CI servers set it automatically.
12:08:44 AM:
12:08:44 AM: Failed to compile.
12:08:44 AM:
12:08:44 AM: [eslint]
12:08:44 AM: src/components/footer/Footer.jsx
12:08:44 AM: Line 9:7: The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
12:08:44 AM: Line 11:13: The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
12:08:44 AM: src/components/header/HeaderSocials.jsx
12:08:44 AM: Line 11:5: Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations react/jsx-no-target-blank
12:08:44 AM: Line 12:5: Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations react/jsx-no-target-blank
12:08:44 AM: Line 13:5: Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations react/jsx-no-target-blank
12:08:44 AM: src/components/nav/Nav.jsx
12:08:44 AM: Line 14:7: The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
12:08:44 AM: β
12:08:44 AM: "build.command" failed
12:08:44 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:08:44 AM: β
12:08:44 AM: Error message
12:08:44 AM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
12:08:44 AM: β
12:08:44 AM: Error location
12:08:44 AM: In Build command from Netlify app:
12:08:44 AM: npm run build
12:08:44 AM: β
12:08:44 AM: Resolved config
12:08:45 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:08:44 AM: build:
12:08:44 AM: command: npm run build
12:08:44 AM: commandOrigin: ui
12:08:44 AM: publish: /opt/build/repo/build
12:08:44 AM: publishOrigin: ui
12:08:44 AM: Caching artifacts
12:08:44 AM: Started saving node modules
12:08:44 AM: Finished saving node modules
12:08:44 AM: Started saving build plugins
12:08:44 AM: Finished saving build plugins
12:08:44 AM: Started saving corepack cache
12:08:44 AM: Finished saving corepack cache
12:08:44 AM: Started saving pip cache
12:08:44 AM: Finished saving pip cache
12:08:44 AM: Started saving emacs cask dependencies
12:08:44 AM: Finished saving emacs cask dependencies
12:08:44 AM: Started saving maven dependencies
12:08:44 AM: Finished saving maven dependencies
12:08:44 AM: Started saving boot dependencies
12:08:44 AM: Finished saving boot dependencies
12:08:44 AM: Started saving rust rustup cache
12:08:44 AM: Finished saving rust rustup cache
12:08:44 AM: Started saving go dependencies
12:08:44 AM: Finished saving go dependencies
12:08:45 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:08:45 AM: Failing build: Failed to build site
12:08:45 AM: Finished processing build request in 1m0.111s
And here is my repo for this app : GitHub - Adipure/portfolio2023
I do not know why it keeps getting errors. I used build command for βNPM RUN BUILDβ.
Please help. Thank you
Thank you for your help @nathanmartin
However, after it finished build, my website page looks nothing but blank page.
here is log :
5:02:56 PM: build-image version: 4e021f34e58c8c6c6ee69b078ac3e861fee3ee31 (focal)
5:02:56 PM: buildbot version: 4e021f34e58c8c6c6ee69b078ac3e861fee3ee31
5:02:56 PM: Fetching cached dependencies
5:02:56 PM: Failed to fetch cache, continuing with build
5:02:56 PM: Starting to prepare the repo for build
5:02:57 PM: No cached dependencies found. Cloning fresh repo
5:02:57 PM: git clone --filter=blob:none https://github.com/Adipure/portfolio2023
5:02:57 PM: Preparing Git Reference refs/heads/main
5:02:57 PM: Parsing package.json dependencies
5:02:59 PM: Starting to install dependencies
5:02:59 PM: Attempting Ruby version 2.7.2, read from environment
5:03:00 PM: Using Ruby version 2.7.2
5:03:01 PM: Downloading and installing node v16.20.0...
5:03:01 PM: Downloading https://nodejs.org/dist/v16.20.0/node-v16.20.0-linux-x64.tar.xz...
5:03:02 PM: Computing checksum with sha256sum
5:03:02 PM: Checksums matched!
5:03:04 PM: Now using node v16.20.0 (npm v8.19.4)
5:03:04 PM: Enabling Node.js Corepack
5:03:04 PM: Started restoring cached build plugins
5:03:04 PM: Finished restoring cached build plugins
5:03:04 PM: Started restoring cached corepack dependencies
5:03:04 PM: Finished restoring cached corepack dependencies
5:03:04 PM: No npm workspaces detected
5:03:04 PM: Started restoring cached node modules
5:03:04 PM: Finished restoring cached node modules
5:03:04 PM: Installing npm packages using npm version 8.19.4
5:03:08 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
5:03:08 PM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
5:03:09 PM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
5:03:10 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
5:03:11 PM: npm WARN deprecated emailjs-com@3.2.0: The SDK name changed to @emailjs/browser
5:03:16 PM: added 1486 packages, and audited 1487 packages in 12s
5:03:16 PM: 228 packages are looking for funding
5:03:16 PM: run `npm fund` for details
5:03:16 PM: 8 high severity vulnerabilities
5:03:16 PM: To address issues that do not require attention, run:
5:03:16 PM: npm audit fix
5:03:16 PM: To address all issues (including breaking changes), run:
5:03:16 PM: npm audit fix --force
5:03:16 PM: Run `npm audit` for details.
5:03:16 PM: npm packages installed
5:03:17 PM: Python version set to 3.8
5:03:17 PM: Started restoring cached go cache
5:03:17 PM: Finished restoring cached go cache
5:03:17 PM: Installing Go version 1.19.5 (requested 1.19.5)
5:03:22 PM: go version go1.19.5 linux/amd64
5:03:22 PM: Using PHP version 8.0
5:03:23 PM: Install dependencies script success
5:03:23 PM: Starting build script
5:03:23 PM: Using stage install dependencies
5:03:24 PM: Detected 1 framework(s)
5:03:24 PM: "create-react-app" at version "5.0.1"
5:03:24 PM: Section completed: initializing
5:03:25 PM: β
5:03:25 PM: Netlify Build
5:03:25 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:03:25 PM: β
5:03:25 PM: β― Version
5:03:25 PM: @netlify/build 29.8.0
5:03:25 PM: β
5:03:25 PM: β― Flags
5:03:25 PM: baseRelDir: true
5:03:25 PM: buildId: 6424d1aa9569b55d4d1371bf
5:03:25 PM: deployId: 6424d1aa9569b55d4d1371c1
5:03:25 PM: β
5:03:25 PM: β― Current directory
5:03:25 PM: /opt/build/repo
5:03:25 PM: β
5:03:25 PM: β― Config file
5:03:25 PM: No config file was defined: using default values.
5:03:25 PM: β
5:03:25 PM: β― Context
5:03:25 PM: production
5:03:25 PM: β
5:03:25 PM: 1. Build command from Netlify app
5:03:25 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:03:25 PM: β
5:03:25 PM: $ CI= npm run build
5:03:25 PM: > react-portfolio-2022@0.1.0 build
5:03:25 PM: > react-scripts build
5:03:27 PM: Creating an optimized production build...
5:03:55 PM: Compiled with warnings.
5:03:55 PM:
5:03:55 PM: [eslint]
5:03:55 PM: src/components/footer/Footer.jsx
5:03:55 PM: Line 9:7: The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
5:03:55 PM: Line 11:13: The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
5:03:55 PM: src/components/header/HeaderSocials.jsx
5:03:55 PM: Line 11:5: Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations react/jsx-no-target-blank
5:03:55 PM: Line 12:5: Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations react/jsx-no-target-blank
5:03:55 PM: Line 13:5: Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations react/jsx-no-target-blank
5:03:55 PM: src/components/nav/Nav.jsx
5:03:55 PM: Line 14:7: The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
5:03:55 PM: Search for the keywords to learn more about each warning.
5:03:55 PM: To ignore, add // eslint-disable-next-line to the line before.
5:03:55 PM: File sizes after gzip:
5:03:55 PM: 66.1 kB build/static/js/main.8d9708d8.js
5:03:56 PM: Starting post processing
5:03:55 PM: 4.54 kB build/static/css/main.fed89fa2.css
5:03:55 PM: The project was built assuming it is hosted at /portfolio2022/.
5:03:56 PM: Post processing - HTML
5:03:55 PM: You can control this with the homepage field in your package.json.
5:03:55 PM: The build folder is ready to be deployed.
5:03:55 PM: Find out more about deployment here:
5:03:57 PM: Post processing - header rules
5:03:55 PM: https://cra.link/deployment
5:03:56 PM: β
5:03:56 PM: (build.command completed in 30.3s)
5:03:57 PM: Post processing - redirect rules
5:03:56 PM: β
5:03:56 PM: 2. Deploy site
5:03:56 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:03:57 PM: Post processing done
5:03:56 PM: β
5:03:56 PM: Starting to deploy site from 'build'
5:03:57 PM: Section completed: postprocessing
5:03:56 PM: Calculating files to upload
5:03:56 PM: 11 new files to upload
5:03:56 PM: 0 new functions to upload
5:03:56 PM: Section completed: deploying
5:03:56 PM: Site deploy was successfully initiated
5:03:56 PM: β
5:03:56 PM: (Deploy site completed in 587ms)
5:03:56 PM: β
5:03:56 PM: Netlify Build Complete
5:03:56 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:03:58 PM: Site is live β¨
5:03:56 PM: β
5:03:56 PM: (Netlify Build completed in 30.9s)
5:03:56 PM: Caching artifacts
5:03:56 PM: Started saving node modules
5:03:56 PM: Finished saving node modules
5:03:56 PM: Started saving build plugins
5:03:56 PM: Finished saving build plugins
5:03:56 PM: Started saving corepack cache
5:03:56 PM: Finished saving corepack cache
5:03:56 PM: Started saving pip cache
5:03:56 PM: Finished saving pip cache
5:03:56 PM: Started saving emacs cask dependencies
5:03:57 PM: Finished saving emacs cask dependencies
5:03:57 PM: Started saving maven dependencies
5:03:57 PM: Finished saving maven dependencies
5:03:57 PM: Started saving boot dependencies
5:03:57 PM: Finished saving boot dependencies
5:03:57 PM: Started saving rust rustup cache
5:03:57 PM: Finished saving rust rustup cache
5:03:57 PM: Started saving go dependencies
5:03:57 PM: Finished saving go dependencies
5:03:59 PM: Build script success
5:03:59 PM: Section completed: building
5:04:00 PM: Uploading Cache of size 175.3MB
5:04:02 PM: Section completed: cleanup
5:04:02 PM: Finished processing build request in 1m5.506s
Do you know how to fix this error? its maybe react app problem but its working fine on my localhost, so i do not figure out.
Never mind, I have figured out. Problem was my Pacakge.json that had a homepage url in order to deploy on the github pages. After I deleted it from package.json, it deploys fine.
@Adipure The issue and solution was as per what I provided, you then encountered a secondary unrelated issue.
Iβve adjusted the flagged solution as such, so it doesnβt confuse others that may encounter this same issue.
Please note that when asking for help, if someone provides you a solution to the issue, that it may not be the solution to βall your issuesβ, itβs quite possible for there to be more than one thing wrong.