Error during build: Could not resolve "../../components/sidebar/Sidebar" from "src/pages/home/Home.jsx". It’s really urgent as I need to deploy it for my interview

When I run npm run build in my local laptop then the there is no error and dist folder is created inside the frontend folder. But here it is showing the following error even though all my routes, file names and import/export are correct.

img/bg3.jpg referenced in /opt/render/project/src/frontend/src/index.css didn't resolve at build time, it will remain unchanged to be resolved at runtime

Jul 9 07:23:22 PM✓ 41 modules transformed.

Jul 9 07:23:22 PMx Build failed in 1.05s

Jul 9 07:23:22 PMerror during build:

Jul 9 07:23:22 PMCould not resolve "../../components/sidebar/Sidebar" from "src/pages/home/Home.jsx"

Jul 9 07:23:22 PMfile: /opt/render/project/src/frontend/src/pages/home/Home.jsx

Jul 9 07:23:22 PM at getRollupError (file:///opt/render/project/src/frontend/node_modules/rollup/dist/es/shared/parseAst.js:396:41)

Jul 9 07:23:22 PM at error (file:///opt/render/project/src/frontend/node_modules/rollup/dist/es/shared/parseAst.js:392:42)

Jul 9 07:23:22 PM at ModuleLoader.handleInvalidResolvedId (file:///opt/render/project/src/frontend/node_modules/rollup/dist/es/shared/node-entry.js:19102:24)

Jul 9 07:23:22 PM at file:///opt/render/project/src/frontend/node_modules/rollup/dist/es/shared/node-entry.js:19062:26

Jul 9 07:23:22 PM==> Build failed 😞

Jul 9 07:23:22 PM==> Common ways to troubleshoot your deploy:

Below are my scripts from package.json

"scripts": {
		"start": "node backend/server.js",
		"start:dev": "cross-env NODE_ENV=development nodemon backend/server.js",
		"start:prod": "cross-env NODE_ENV=production nodemon backend/server.js",
		"build": "npm install && npm install --prefix frontend && npm run build --prefix frontend"

Build Command is npm run build and Start Command is npm run start in settings. I have removed NODE_ENV production from Environment because then again it shows build failed as vite is a devdependency and is not downloaded. NODE_ENV development shows again the above Error during build. Adding --production=false again shows the same error.


It looks like my colleague is already helping you via the community post you’ve opened. Please follow up on the community post.

Render Support, UTC+3

That error is only coming while I try to deploy. In the development and production mode there is no such error