Netlify build feiled code 2

Bilding is filed by my project https://roaring-alpaca-90c557.netlify.app/ and i recive a message:

" 9:42:29 PM: Creating an optimized production build…
9:42:32 PM: One of your dependencies, babel-preset-react-app, is importing the
9:42:32 PM: “@babel/plugin-proposal-private-property-in-object” package without
9:42:32 PM: declaring it in its dependencies. This is currently working because
9:42:32 PM: “@babel/plugin-proposal-private-property-in-object” is already in your
9:42:32 PM: node_modules folder for unrelated reasons, but it may break at any time.
9:42:32 PM: babel-preset-react-app is part of the create-react-app project, which
9:42:32 PM: is not maintianed anymore. It is thus unlikely that this bug will
9:42:32 PM: ever be fixed. Add “@babel/plugin-proposal-private-property-in-object” to
9:42:32 PM: your devDependencies to work around this error. This will make this message
9:42:32 PM: go away.
9:42:34 PM: Failed during stage “building site”: Build script returned non-zero exit code: 2
9:42:34 PM:
9:42:34 PM: Treating warnings as errors because process.env.CI = true.
9:42:34 PM: Most CI servers set it automatically.
9:42:34 PM:
9:42:34 PM: Failed to compile.
9:42:34 PM:
9:42:34 PM: [eslint]
9:42:34 PM: src/WeatherInfo.js
9:42:34 PM: Line 3:8: “WeatherForecast” is defined but never used no-unused-vars
9:42:34 PM: ​
9:42:34 PM: “build.command” failed
9:42:34 PM: ────────────────────────────────────────────────────────────────
9:42:34 PM: ​
9:42:34 PM: Error message
9:42:34 PM: Command failed with exit code 1: npm run build
9:42:34 PM: ​
9:42:34 PM: Error location
9:42:34 PM: In Build command from Netlify app:
9:42:34 PM: npm run build
9:42:34 PM: ​
9:42:34 PM: Resolved config
9:42:34 PM: build:
9:42:34 PM: command: npm run build
9:42:34 PM: commandOrigin: ui
9:42:34 PM: publish: /opt/build/repo/build
9:42:34 PM: publishOrigin: ui
9:42:34 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:42:34 PM: Failing build: Failed to build site
9:42:35 PM: Finished processing build request in 23.255s"

I already fixed it. I had updated my Nodejs and npm. I dont know if that exactly helped.

thanks for coming back and sharing your solution!

1 Like