Hello guys have been trying to deploy both the frontend and backend of my mern stack application on render…but ever since , the deployment has never been successfull every day i encounter new errors …could you guys please help me deploy my mern application on render successfully
Hi,
It’s hard for anyone to provide assistance without any details.
When asking for assistance, please elaborate on your issue in as much detail as possible, e.g. logs/error messages, what you’ve tried, reproduction steps, screenshots, etc. to show the problem you’re experiencing.
For a MERN app on Render, the components would commonly be:
-
MongoDB
Render doesn’t currently offer managed MongoDB instances. It’s possible to run your own, but this would require a paid Private Service and you’d need to be comfortable with deploying, configuring, and maintaining the instance yourself, e.g., updates, optimizations, backups, etc.
If you’d prefer a managed MongoDB service, you could use something like MongoDB Atlas. Atlas usually needs inbound IPs allowlisted, so Render’s outbound IPs are covered here: https://docs.render.com/static-outbound-ip-addresses -
Express
The Express app would be deployed to a Render Web Service, we have a guide: https://docs.render.com/deploy-node-express-app -
React
React apps can deployed to a Render Static Site, we have a guide: https://docs.render.com/deploy-create-react-app -
Node
Express/React use this, so it’s a bit of a pointless letter of the acronym.
However, Render is flexible, so you could serve your React app through the Express app if you wanted. Those implementation decisions would be up to you.
Alan
Sure …some of the errors i encountered while deploying the site are as follows , for my backend deployment on render i encountered the error below
==> Checking out commit 9229a712952aaa9a0b7316b2d60b7839bd2f03bd in branch main
==> Requesting node version 18.x
==> Using Node version 18.19.1 via /opt/render/project/src/package.json
==> Running build command ‘npm install --force’…
added 290 packages, and audited 526 packages in 23s
53 packages are looking for funding
run npm fund
for details
9 vulnerabilities (6 moderate, 3 high)
To address issues that do not require attention, run:
npm audit fix
Some issues need review, and may require choosing
a different dependency.
Run npm audit
for details.
==> Uploading build…
==> Build uploaded in 9s
==> Build successful
==> Deploying…
==> Requesting node version 18.x
==> Using Node version 18.19.1 via /opt/render/project/src/package.json
==> Running ‘npm run start’
backend@1.0.0 start
node server.js
Server Running At 10000
Invalid connection string
Your service is live
Error: ENOENT: no such file or directory, stat ‘/opt/render/project/src/client/build/index.html’ and for my frontend deployment on render i encountered the error below
==> Build failed
==> Publish directory build does not exist!
Runnpm audit
for details.
npm audit fix --force
To address all issues (including breaking changes), run:
npm audit fix
To address issues that do not require attention, run:
78 vulnerabilities (1 low, 22 moderate, 41 high, 14 critical)
runnpm fund
for details
150 packages are looking for funding
changed 1 package, and audited 2234 packages in 8s
==> Running build command ‘npm install --force’…
poetry --version
You can test that everything is set up by executing:
Alternatively, you can call Poetry explicitly with/opt/render/project/poetry/bin/poetry
.
Addexport PATH="/opt/render/project/poetry/bin:$PATH"
to your shell configuration file.
environment variable.
To get started you need Poetry’s bin directory (/opt/render/project/poetry/bin) in yourPATH
Poetry (1.7.1) is installed now. Great!
Installing Poetry (1.7.1): Done
Installing Poetry (1.7.1): Creating script
Installing Poetry (1.7.1): Installing Poetry
Installing Poetry (1.7.1): Creating environment
Installing Poetry (1.7.1)
and these changes will be reverted.
You can uninstall at any time by executing this script with the --uninstall option,
/opt/render/project/poetry/bin
It will add thepoetry
command to Poetry’s bin directory, located at:
a dependency and package manager for Python.
This will download and install the latest version of Poetry,
Welcome to Poetry!
Retrieving Poetry metadata
==> Installing Poetry version 1.7.1
==> Using Poetry version 1.7.1 (default)
==> Using Python version 3.11.7 (default)
Run npm audit
for details.
npm audit fix --force
To address all issues (including breaking changes), run:
npm audit fix
To address issues that do not require attention, run:
78 vulnerabilities (1 low, 22 moderate, 41 high, 14 critical)
run npm fund
for details
150 packages are looking for funding
added 37 packages, removed 3 packages, changed 26 packages, and audited 2234 packages in 11s
Run npm audit
for details.
npm audit fix --force
To address all issues (including breaking changes), run:
npm audit fix
To address issues that do not require attention, run:
79 vulnerabilities (1 low, 22 moderate, 41 high, 15 critical)
run npm fund
for details
146 packages are looking for funding
added 1946 packages, and audited 2200 packages in 58s
==> Installing dependencies with npm…
==> Using Ruby version 3.2.2 (default)
==> Using Node version 20.10.0 (default)
==> Checking out commit 368e6966c201cc04f4c9b7ae7d0dd8275a3b612b in branch main
note that the frontend of my project’s repository is https://github.com/Felygit/frontend-nurufinance , while the backend of my project’s repository is https://github.com/Felygit/api-nurufinance …please assist me deploy my project on render
Thanks for some details, the formatting is a little hard to read, you can add three backticks ````` before and after code blocks to make them a bit more readable.
It looks like there are multiple issues here:
Your backend tries to reference the built client React code:
Error: ENOENT: no such file or directory, stat ‘/opt/render/project/src/client/build/index.html’
But it won’t be able to find it as it’s in a different repo. You’ll need to choose to either:
-
Make a monorepo, by moving your frontend/client code into your backend repo. Then, build it as part of the build command and serve it from the backend.
-
OR, update the backend code to not look for the frontend/client code and keep them separate, Static Site for React, Web Service for backend.
There’s also an Invalid connection string
message in there, which I assume is an incorrect set MongoDB connection string.
The frontend deploy logs show:
Publish directory build does not exist!
So you’ve set a Publish Directory to “build” but not created it, which implies you’re not running your build script.
Alan
when i try to make my project as monorepo as in the git repository GitHub - Felygit/drip i still encounter the error ```
Error: ENOENT: no such file or directory, stat ‘/opt/render/project/src/client/build/i please friend assist me deploy this successfully
The error is pretty clear. The /opt/render/project/src/
is where Render downloads your code, so client/build/index.html
needs to be in your repo or generated as part of your build command.
Alan
therefore what is the correct solution to that, friend
please access my repository at GitHub - Felygit/drip and assist me deploy it …Thanks
Specific code implementation would be beyond the scope of our support. This doesn’t appear to be an issue with Render. Maybe other community members will be able to assist you in implementing your code.
From a quick look at the repo, it looks like you’re serving your client-side code through Express, so you likely only need to deploy to a Web Service (no separate Static Site).
Alan
if i deploy it as a web service successfully am i going to access my frontend as well,friend
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.