Having trouble deploying server of mern project

I keep getting Error: Cannot find module ‘/opt/render/project/src/index.js’ when i try to deploy my backend
here is my package.json for the server below,

{
“name”: “client”,
“private”: true,
“version”: “0.0.0”,
“type”: “module”,
“scripts”: {
“dev”: “vite”,
“build”: “vite build”,
“lint”: “eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0”,
“preview”: “vite preview”
},
“dependencies”: {
“react”: “^18.2.0”,
“react-dom”: “^18.2.0”,
“react-router-dom”: “^6.17.0”
},
“devDependencies”: {
“@types/react”: “^18.2.15”,
“@types/react-dom”: “^18.2.7”,
“@vitejs/plugin-react”: “^4.0.3”,
“eslint”: “^8.45.0”,
“eslint-plugin-react”: “^7.32.2”,
“eslint-plugin-react-hooks”: “^4.6.0”,
“eslint-plugin-react-refresh”: “^0.4.3”,
“vite”: “^4.4.5”
}
}

Hi,

There’s not much detail here, but the “cannot find” error shows you don’t have an index.js file in the root of your repo. Maybe you have a monorepo (e.g. “frontend” and “backend” folders at the root of your repo)?

Ensure the path to your index.js is correct.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.