PLEASE help us help you by writing a good post!
Hi,
I am trying to deploy my react application on netlify. I am getting this error : TypeError: Cannot read properties of undefined (reading ‘get’). Because of this error, my site is not getting deployed.
I am not able to understand from where this error is getting generated and am not sure how to resolve this.
My site name is: amazing-brahmagupta-ac149f
Please find the screenshot and error log below.
error log :
9:18:18 PM: $ npm run build
9:18:19 PM: > foodie-world@0.1.0 build
9:18:19 PM: > react-scripts build
9:18:20 PM: Creating an optimized production build…
9:18:44 PM: Failed to compile.
9:18:44 PM:
9:18:44 PM: TypeError: Cannot read properties of undefined (reading ‘get’)
9:18:44 PM:
9:18:44 PM: ────────────────────────────────────────────────────────────────
9:18:44 PM: “build.command” failed
9:18:44 PM: ────────────────────────────────────────────────────────────────
9:18:44 PM:
9:18:44 PM: Error message
9:18:44 PM: Command failed with exit code 1: npm run build
9:18:44 PM:
9:18:44 PM: Error location
9:18:44 PM: In Build command from Netlify app:
9:18:44 PM: npm run build
9:18:44 PM:
9:18:44 PM: Resolved config
9:18:44 PM: build:
9:18:44 PM: command: npm run build
9:18:44 PM: commandOrigin: ui
9:18:44 PM: publish: /opt/build/repo/build
9:18:44 PM: publishOrigin: ui
9:18:45 PM: Caching artifacts
9:18:45 PM: Started saving node modules
9:18:45 PM: Finished saving node modules
9:18:45 PM: Started saving build plugins
9:18:45 PM: Finished saving build plugins
9:18:45 PM: Started saving pip cache
9:18:45 PM: Finished saving pip cache
9:18:45 PM: Started saving emacs cask dependencies
9:18:45 PM: Finished saving emacs cask dependencies
9:18:45 PM: Started saving maven dependencies
9:18:45 PM: Finished saving maven dependencies
9:18:45 PM: Started saving boot dependencies
9:18:45 PM: Finished saving boot dependencies
9:18:45 PM: Started saving rust rustup cache
9:18:45 PM: Finished saving rust rustup cache
9:18:45 PM: Started saving go dependencies
9:18:45 PM: Finished saving go dependencies
9:18:47 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:18:47 PM: Creating deploy upload records
9:18:47 PM: Failing build: Failed to build site
9:18:47 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
9:18:47 PM: Finished processing build request in 1m4.924487006s