Error during build. 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: https://docs.render.com/troubleshooting-deploys

Below are my scripts from package.json

"scripts": {
		"start": "node backend/server.js",
		"start:dev": "cross-env DEBUG=socket.io:server 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

Hi there,

Render services are intended to only be run in production mode. devDependencies do not get installed in production mode, so if you need to use vite try to include it among your primary dependencies.

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

I have removed NODE_ENV production and it installs vite but the above is still showm

Hi there,

The next thing to look into is the specific errors you are seeing, e.g.

Could not resolve "../../components/sidebar/Sidebar" from "src/pages/home/Home.jsx"

This type of error is commonly caused by casing issues, where your code is referencing a file and/or directory in uppercase but the actual file and/or directory is in lowercase, or vice versa.

In the case of this particular error, check to ensure the casing of Sidebar in your repository matches what your code is referencing. Then go through all the errors like this and check for casing mismatches on each one.

Hope that helps!

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

I have checked this and everything is correct. My project is running firmly in development and production but when I try deploying it then the above error is occurring even though there is no error or a typo in that place which is mentioned above

Hi there,

In order for us to be able to provide more detailed assistance, you will need to reach out to us privately so we can take a closer look at your services. You can do this by logging into the Render Dashboard, clicking the Help link at the top, and selecting the service you are referring to.

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

Okay

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