How to fix it and best if someone can assist with the points, flow to deploy back-end and admin dashboard for a web application.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi there,
To set
legacy-peer-deps
you need to modify the.npmrc
file in your project. This file allows you to customize how npm behaves when running commands. If you don’t already have this file, you can create it in the root directory of your project.Here is how you can do it:
In the root directory of your project, create or open the
.npmrc
file.In the
.npmrc
file, add the following line:Save and close the file.
Now, npm will use the old behavior for handling peer dependencies, which was to essentially ignore them unless
--peer
is explicitly provided to npm install.For deploying your MERN application (MongoDB, Express.js, React.js, Node.js) on DigitalOcean, you can follow these steps:
Create a new Droplet: From the DigitalOcean dashboard, create a new Droplet. Choose an image that includes Node.js or use a basic one like Ubuntu and install Node.js later.
Transfer your application files: Transfer your application files to the Droplet. You can use a tool like
scp
orrsync
for this. Or if you have a GitHub project, you can use thegit clone
command to clone your project on the Droplet.Install dependencies: SSH into your Droplet and navigate to your project directory. Run
npm install
to install your application’s dependencies. You may also need to install MongoDB if it’s not already installed.Set environment variables: If your application uses environment variables (for example, to connect to MongoDB), set these on your Droplet. You can do this in the terminal with
export VAR_NAME=value
, or by adding these lines to your~/.bashrc
or~/.bash_profile
file.Start your application: From your project directory, start your application with
npm start
. If you want your application to run in the background, consider using a process manager likepm2
.Configure your firewall: If necessary, configure your Droplet’s firewall to allow traffic to the port your application is running on.
Deploy the React Admin Dashboard: You can build your admin dashboard using
npm run build
oryarn build
in your React project directory. This will create abuild
folder that contains the static files of your project which can be served by a web server. You can usenginx
to serve these static files on DigitalOcean Droplet.For a more in-depth tutorial, I would recommend following the steps here:
Also, for production, I would personally go with the DigitalOcean Managed Database clusters:
Best,
Bobby