@ayush22 The part of the build log that you’ve provided is the result not the cause.
E.g. It shows that there was an error, but doesn’t provide the information on what caused it.
It helps if you provide the full build log, or at the very least the part that actually shows the error.
Build command from Netlify app
1:24:24 PM: ────────────────────────────────────────────────────────────────
1:24:24 PM:
1:24:24 PM: $ npm run build
1:24:24 PM: > todolist@0.1.0 build
1:24:24 PM: > react-scripts build
1:24:25 PM: Creating an optimized production build…
1:24:29 PM: One of your dependencies, babel-preset-react-app, is importing the
1:24:29 PM: “@babel/plugin-proposal-private-property-in-object” package without
1:24:29 PM: declaring it in its dependencies. This is currently working because
1:24:29 PM: “@babel/plugin-proposal-private-property-in-object” is already in your
1:24:29 PM: node_modules folder for unrelated reasons, but it may break at any time.
1:24:29 PM: babel-preset-react-app is part of the create-react-app project, which
1:24:29 PM: is not maintianed anymore. It is thus unlikely that this bug will
1:24:29 PM: ever be fixed. Add “@babel/plugin-proposal-private-property-in-object” to
1:24:29 PM: your devDependencies to work around this error. This will make this message
1:24:29 PM: go away.
1:24:37 PM: Failed during stage “building site”: Build script returned non-zero exit code: 2
1:24:37 PM:
1:24:37 PM: Treating warnings as errors because process.env.CI = true.
1:24:37 PM: Most CI servers set it automatically.
1:24:37 PM:
1:24:37 PM: Failed to compile.
1:24:37 PM:
1:24:37 PM: [eslint]
1:24:37 PM: src/Routes/modifyTodo/ModifyTodo.js
1:24:37 PM: Line 42:8: React Hook useEffect has a missing dependency: “todoDocRef”. Either include it or remove the dependency array react-hooks/exhaustive-deps
1:24:37 PM: Line 96:37: The array literal notation is preferable no-array-constructor
1:24:37 PM: src/components/navbar/navbar.js
1:24:37 PM: Line 5:10: “dark” is defined but never used no-unused-vars
1:24:37 PM: Line 5:16: “light” is defined but never used no-unused-vars
1:24:37 PM: Line 15:9: “theme” is assigned a value but never used no-unused-vars
1:24:37 PM: src/components/todoCard/TodoCard.js
1:24:37 PM: Line 34:8: React Hook useEffect has a missing dependency: “docRef”. Either include it or remove the dependency array react-hooks/exhaustive-deps
1:24:37 PM: src/components/todoListContainer/TodoListContainer.js
1:24:37 PM: Line 36:8: React Hook useEffect has a missing dependency: “dispatch”. Either include it or remove the dependency array react-hooks/exhaustive-deps
1:24:37 PM:
1:24:37 PM: “build.command” failed
1:24:37 PM: ────────────────────────────────────────────────────────────────
1:24:37 PM:
1:24:37 PM: Error message
1:24:37 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
1:24:37 PM:
1:24:37 PM: Error location
1:24:37 PM: In Build command from Netlify app:
1:24:37 PM: npm run build
1:24:37 PM:
1:24:37 PM: Resolved config
1:24:37 PM: build:
1:24:37 PM: command: npm run build
1:24:37 PM: commandOrigin: ui
1:24:37 PM: environment:
1:24:37 PM: - REACT_APP_API_KEY
1:24:37 PM: - REACT_APP_APP_ID
1:24:37 PM: - REACT_APP_AUTH_DOMAIN
1:24:37 PM: - REACT_APP_MESSAGING_SENDER_ID
1:24:37 PM: - REACT_APP_PROJECT_ID
1:24:37 PM: - REACT_APP_STORAGE_BUCKET
1:24:37 PM: publish: /opt/build/repo/build
1:24:37 PM: publishOrigin: ui
1:24:37 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:24:37 PM: Failing build: Failed to build site
i think this will help you to get the problem, that i am unable to find.
1:24:37 PM: Treating warnings as errors because process.env.CI = true.
1:24:37 PM: Most CI servers set it automatically.
Combined with the warnings thrown by eslint:
1:24:37 PM: [eslint]
1:24:37 PM: src/Routes/modifyTodo/ModifyTodo.js
1:24:37 PM: Line 42:8: React Hook useEffect has a missing dependency: “todoDocRef”. Either include it or remove the dependency array react-hooks/exhaustive-deps
As it says, warnings are treated as errors by default when CI is true
If you don’t want to fix the warnings, you can set CI to false.
The easiest way to do this is to change your build command:
From: npm run build
To: CI= npm run build