1

This is the vscode editor page where i am getting error . I am not able to conclude why? please anyone tell where i am going wrong. I am deploying a website which consists of reactJs and nodeJs and MongoDB

VS Code editor Error

1

this is my index.js file

const express = require("express");
const app = express();
const mongoose = require("mongoose");
const dotenv = require("dotenv");
const userRoute = require("./routes/user");
const authRoute = require("./routes/auth");
const productRoute = require("./routes/product");
const cartRoute = require("./routes/cart");
const orderRoute = require("./routes/order");
const stripeRoute = require("./routes/stripe");

mongoose.connect("MONGO_URL").then(()=>console.log("DB Connection Sucessful")).catch((err)=>{
    console.log(err);
});

dotenv.config();
mongoose
  .connect(process.env.MONGO_URL)
  .then(() => console.log("DB Connection Successfull!"))
  .catch((err) => {
    console.log(err);
  });


app.use(express.json());
app.use("/api/auth",authRoute);
app.use("/api/user",userRoute);
app.use("/api/products",productRoute);
app.use("/api/carts", cartRoute);
app.use("/api/orders", orderRoute);
app.use("/api/checkout", stripeRoute);


app.use(express.static(path.join(__dirname, "/frontend/build")));

app.get('*', (req, res) => {
  res.sendFile(path.join(__dirname, '/frontend/build', 'index.html'));
});


app.listen(process.env.PORT || 5000, ()=>{
    console.log("Backend server is running!");
});
vimuth
  • 5,064
  • 33
  • 79
  • 116
  • I think your project has dependency conflict. Your some packages doesn't admission current packages versions. [Here](https://stackoverflow.com/questions/64573177/unable-to-resolve-dependency-tree-error-when-installing-npm-packages) is a subject like your problem. I hope this link helps you :) – Halil Aug 25 '22 at 18:38

0 Answers0