Getting errors while try to deploy my react app on Spheron

when I deploy it on vercel it works perfectly but on spheron getting these errors …

12:26:57 AM
Creating an optimized production build...
12:27:03 AM
e[0;33mOne of your dependencies, babel-preset-react-app, is importing the
12:27:03 AM
"@babel/plugin-proposal-private-property-in-object" package without
12:27:03 AM
declaring it in its dependencies. This is currently working because
12:27:03 AM
"@babel/plugin-proposal-private-property-in-object" is already in your
12:27:03 AM
node_modules folder for unrelated reasons, but it e[1mmay break at any timee[0;33m.
12:27:03 AM
babel-preset-react-app is part of the create-react-app project, e[1mwhich
12:27:03 AM
is not maintianed anymoree[0;33m. It is thus unlikely that this bug will
12:27:03 AM
ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
12:27:03 AM
your devDependencies to work around this error. This will make this message
12:27:03 AM
go away.e[0m
12:27:50 AM
Failed to compile.
12:27:50 AM
Module not found: Error: Can't resolve 'assert' in '/app/cloned-repository/flatearthdao/node_modules/ethereumjs-util/dist.browser'
12:27:50 AM
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
12:27:50 AM
This is no longer the case. Verify if you need this module and configure a polyfill for it.
12:27:50 AM
If you want to include a polyfill, you need to:
12:27:50 AM
- add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
12:27:50 AM
- install 'assert'
12:27:50 AM
If you don't want to include a polyfill, you can use an empty module like this:
12:27:50 AM
resolve.fallback: { "assert": false }
12:27:50 AM
error Command failed with exit code 1.
12:27:50 AM
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
12:27:50 AM
Error while encrypting files with code: 1

how can I resolve this?

It looks like you have some build issue in your existing code & does not seems to be issue around the Spheron. @rekpero can you help me solving the issue please.

this is the response received from gpt:

It looks like you are encountering some issues while trying to build and deploy a ReactJS application. Let’s break down the error messages and address them one by one:

  1. babel-preset-react-app Warning: The warning about babel-preset-react-app is related to a dependency issue. It’s suggesting that the package is importing another package (@babel/plugin-proposal-private-property-in-object) without declaring it in its dependencies. To resolve this, you should add "@babel/plugin-proposal-private-property-in-object" to your project’s devDependencies in your package.json file. This will prevent the warning from appearing.
  2. Module not found: Error: Can’t resolve ‘assert’: This error indicates that the module ‘assert’ is missing or not properly resolved in your project. To fix this, follow the instructions provided in the error message:
  • Add a fallback for ‘assert’ in your webpack configuration. In your webpack.config.js or similar file, you can add:

javascriptCopy code

resolve: {
  fallback: {
    "assert": require.resolve("assert/")
  }
}
  • Install the ‘assert’ module by running npm install assert or yarn add assert in your project directory.
  1. Webpack Polyfill Message: The message about webpack polyfills is related to webpack version changes. Webpack 5 no longer includes polyfills for node.js core modules by default. You have two options:
  • Add the fallback configuration mentioned earlier in your webpack config.
  • If you don’t need the ‘assert’ module, you can set it to false in the fallback to exclude the polyfill:

javascriptCopy code

resolve: {
  fallback: {
    "assert": false
  }
}

Once you have addressed these issues, you should be able to build and deploy your ReactJS application successfully. If you encounter any other errors or issues during the process, please provide more details, and I’ll be happy to assist further.

1 Like