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!
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:
legacy-peer-deps=true
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 or rsync for this. Or if you have a GitHub project, you can use the git 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 like pm2.
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 or yarn build in your React project directory. This will create a build folder that contains the static files of your project which can be served by a web server. You can use nginx to serve these static files on DigitalOcean Droplet.
For a more in-depth tutorial, I would recommend following the steps here:
https://www.digitalocean.com/community/tutorials/getting-started-with-the-mern-stack
Also, for production, I would personally go with the DigitalOcean Managed Database clusters:
https://www.digitalocean.com/products/managed-databases-mongodb
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.