Error with deploying react site

Hi everyone!

I try first time to deploy my react site here. I am not sure what I am doing wrong. Should I change something in settings?

6:01:29 PM: Netlify Build                                                 
6:01:29 PM: ────────────────────────────────────────────────────────────────
6:01:29 PM: ​
6:01:29 PM: ❯ Version
6:01:29 PM:   @netlify/build 29.20.6
6:01:29 PM: ​
6:01:29 PM: ❯ Flags
6:01:29 PM:   baseRelDir: true
6:01:29 PM:   buildId: 64e77eaaf55b41262c93d8dc
6:01:29 PM:   deployId: 64e77eaaf55b41262c93d8de
6:01:29 PM: ​
6:01:29 PM: ❯ Current directory
6:01:29 PM:   /opt/build/repo/frontend
6:01:29 PM: ​
6:01:29 PM: ❯ Config file
6:01:29 PM:   No config file was defined: using default values.
6:01:29 PM: ​
6:01:29 PM: ❯ Context
6:01:29 PM:   production
6:01:30 PM: ​
6:01:30 PM: Build command from Netlify app                                
6:01:30 PM: ────────────────────────────────────────────────────────────────
6:01:30 PM: ​
6:01:30 PM: $ npm run build
6:01:30 PM: > books@0.1.0 build
6:01:30 PM: > react-scripts build
6:01:31 PM: Creating an optimized production build...
6:01:38 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:01:35 PM: One of your dependencies, babel-preset-react-app, is importing the
6:01:35 PM: @babel/plugin-proposal-private-property-in-object package without
6:01:35 PM: declaring it in its dependencies. This is currently working because
6:01:35 PM: @babel/plugin-proposal-private-property-in-object is already in your
6:01:35 PM: node_modules folder for unrelated reasons, but it may break at any time.
6:01:35 PM: babel-preset-react-app is part of the create-react-app project, which
6:01:35 PM: is not maintianed anymore. It is thus unlikely that this bug will
6:01:35 PM: ever be fixed. Add @babel/plugin-proposal-private-property-in-object to
6:01:35 PM: your devDependencies to work around this error. This will make this message
6:01:35 PM: go away.
6:01:37 PM: 
6:01:37 PM: Treating warnings as errors because process.env.CI = true.
6:01:37 PM: Most CI servers set it automatically.
6:01:37 PM: 
6:01:37 PM: Failed to compile.
6:01:37 PM: 
6:01:37 PM: [eslint]
6:01:37 PM: src/App.js
6:01:37 PM:   Line 1:33:  'useState' is defined but never used                                                                           no-unused-vars
6:01:37 PM:   Line 11:6:  React Hook useEffect has a missing dependency: 'fetchBooks'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
6:01:37 PM: src/BookCreate.js
6:01:37 PM:   Line 33:20:   Expected '===' and instead saw '=='  eqeqeq
6:01:37 PM:   Line 33:35:   Expected '===' and instead saw '=='  eqeqeq
6:01:37 PM:   Line 33:50:   Expected '===' and instead saw '=='  eqeqeq
6:01:37 PM:   Line 33:65:   Expected '===' and instead saw '=='  eqeqeq
6:01:37 PM:   Line 49:19:   Expected '===' and instead saw '=='  eqeqeq
6:01:37 PM:   Line 101:40:  Expected '!==' and instead saw '!='  eqeqeq
6:01:37 PM: src/context/books.js
6:01:37 PM:   Line 15:9:   The 'createBook' function makes the dependencies of useEffect Hook (at line 68) change on every render. To fix this, wrap the definition of 'createBook' in its own useCallback() Hook          react-hooks/exhaustive-deps
6:01:37 PM:   Line 35:9:   The 'deleteBookById' function makes the dependencies of useEffect Hook (at line 72) change on every render. To fix this, wrap the definition of 'deleteBookById' in its own useCallback() Hook  react-hooks/exhaustive-deps
6:01:37 PM:   Line 39:22:  Expected '!==' and instead saw '!='                                                                                                                                                             eqeqeq
6:01:37 PM:   Line 45:9:   The 'editBookById' function makes the dependencies of useEffect Hook (at line 76) change on every render. To fix this, wrap the definition of 'editBookById' in its own useCallback() Hook      react-hooks/exhaustive-deps
6:01:37 PM:   Line 56:19:  Expected '===' and instead saw '=='                                                                                                                                                             eqeqeq
6:01:37 PM: ​
6:01:37 PM: build.command failed                                        
6:01:37 PM: ────────────────────────────────────────────────────────────────
6:01:37 PM: ​
6:01:37 PM:   Error message
6:01:37 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
6:01:37 PM: ​
6:01:37 PM:   Error location
6:01:37 PM:   In Build command from Netlify app:
6:01:37 PM:   npm run build
6:01:37 PM: ​
6:01:37 PM:   Resolved config
6:01:37 PM:   build:
6:01:37 PM:     base: /opt/build/repo/frontend
6:01:37 PM:     command: npm run build
6:01:37 PM:     commandOrigin: ui
6:01:37 PM:     publish: /opt/build/repo/frontend
6:01:37 PM:     publishOrigin: default
6:01:38 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:01:38 PM: Failing build: Failed to build site
6:01:39 PM: Finished processing build request in 28.35s

Name of website:

fascinating-eclair-8b9d92

Thank you in advance!

Hi @karolina93,

Thanks for reaching out and welcome to Netlify’s Support Forums!

Looking at your latest deploy, you’ll need to resolve the error on this line within the /src/App.js file.

After fixing that error are you able to deploy?

Hi @Melvin

Thank you for your answer!
I tried to fix this error, but still I can’t deploy my website.

Should I really change it in my code? Line 33:20: Expected ‘===’ and instead saw ‘==’

8:03:08 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
8:02:59 PM: Netlify Build                                                 
8:02:59 PM: ────────────────────────────────────────────────────────────────
8:02:59 PM: ​
8:02:59 PM: ❯ Version
8:02:59 PM:   @netlify/build 29.20.6
8:02:59 PM: ​
8:02:59 PM: ❯ Flags
8:02:59 PM:   baseRelDir: true
8:02:59 PM:   buildId: 64e79b0ce83fdb0507ecf21e
8:02:59 PM:   deployId: 64e79b0ce83fdb0507ecf220
8:02:59 PM: ​
8:02:59 PM: ❯ Current directory
8:02:59 PM:   /opt/build/repo/frontend
8:02:59 PM: ​
8:02:59 PM: ❯ Config file
8:02:59 PM:   No config file was defined: using default values.
8:02:59 PM: ​
8:02:59 PM: ❯ Context
8:02:59 PM:   production
8:03:00 PM: ​
8:03:00 PM: Build command from Netlify app                                
8:03:00 PM: ────────────────────────────────────────────────────────────────
8:03:00 PM: ​
8:03:00 PM: $ npm run build
8:03:00 PM: > books@0.1.0 build
8:03:00 PM: > react-scripts build
8:03:01 PM: Creating an optimized production build...
8:03:05 PM: One of your dependencies, babel-preset-react-app, is importing the
8:03:05 PM: @babel/plugin-proposal-private-property-in-object package without
8:03:05 PM: declaring it in its dependencies. This is currently working because
8:03:05 PM: @babel/plugin-proposal-private-property-in-object is already in your
8:03:05 PM: node_modules folder for unrelated reasons, but it may break at any time.
8:03:05 PM: babel-preset-react-app is part of the create-react-app project, which
8:03:05 PM: is not maintianed anymore. It is thus unlikely that this bug will
8:03:05 PM: ever be fixed. Add @babel/plugin-proposal-private-property-in-object to
8:03:05 PM: your devDependencies to work around this error. This will make this message
8:03:05 PM: go away.
8:03:07 PM: 
8:03:07 PM: Treating warnings as errors because process.env.CI = true.
8:03:07 PM: Most CI servers set it automatically.
8:03:07 PM: 
8:03:07 PM: Failed to compile.
8:03:07 PM: 
8:03:07 PM: [eslint]
8:03:07 PM: src/BookCreate.js
8:03:07 PM:   Line 33:20:   Expected '===' and instead saw '=='  eqeqeq
8:03:07 PM:   Line 33:35:   Expected '===' and instead saw '=='  eqeqeq
8:03:07 PM:   Line 33:50:   Expected '===' and instead saw '=='  eqeqeq
8:03:07 PM:   Line 33:65:   Expected '===' and instead saw '=='  eqeqeq
8:03:07 PM:   Line 49:19:   Expected '===' and instead saw '=='  eqeqeq
8:03:07 PM:   Line 101:40:  Expected '!==' and instead saw '!='  eqeqeq
8:03:07 PM: src/context/books.js
8:03:07 PM:   Line 38:22:  Expected '!==' and instead saw '!='                                                                            eqeqeq
8:03:07 PM:   Line 55:19:  Expected '===' and instead saw '=='                                                                            eqeqeq
8:03:07 PM:   Line 67:6:   React Hook useEffect has a missing dependency: 'fetchBooks'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
8:03:07 PM:   Line 71:6:   React Hook useEffect has a missing dependency: 'fetchBooks'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
8:03:07 PM:   Line 75:6:   React Hook useEffect has a missing dependency: 'fetchBooks'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
8:03:07 PM: ​
8:03:07 PM: build.command failed                                        
8:03:07 PM: ────────────────────────────────────────────────────────────────
8:03:07 PM: ​
8:03:07 PM:   Error message
8:03:07 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
8:03:07 PM: ​
8:03:07 PM:   Error location
8:03:07 PM:   In Build command from Netlify app:
8:03:07 PM:   npm run build
8:03:07 PM: ​
8:03:07 PM:   Resolved config
8:03:07 PM:   build:
8:03:07 PM:     base: /opt/build/repo/frontend
8:03:07 PM:     command: npm run build
8:03:07 PM:     commandOrigin: ui
8:03:07 PM:     publish: /opt/build/repo/frontend
8:03:07 PM:     publishOrigin: default
8:03:08 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:03:08 PM: Failing build: Failed to build site
8:03:09 PM: Finished processing build request in 28.022s

Thank you in advance!

Now it works!

I added in settings CI= npm run build and I created new variable CI with value false.

Hi :wave:t6: , thanks for coming back and sharing your solution with the community! I’m glad you figured it out. Happy building! :rocket: