Deployement faild on render

Hi there,

I’m currently facing an issue while trying to deploy my MERN stack website on Render. Despite working perfectly fine on my local machine, it consistently fails during deployment with the following error message:
Failed to load config from /opt/render/project/src/client/vite.config.js
Error during build:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package ‘@vitejs/plugin-react-swc’ imported from /opt/render/project/src/client/vite.config.js.timestamp-1711025235781-a9c4696c2aeac.mjs
To address this, I’ve taken several steps:

  1. I’ve ensured that all the necessary development dependencies for Vite are listed in my package.json file.
  2. I’ve double-checked the location of my vite.config.js file to make sure it’s in the correct directory.
  3. Here’s how my script section looks in package.json:
    “scripts”: {
    “dev”: “nodemon api/index.js”,
    “start”: “node api/index.js”,
    “build”: “npm install && npm install --prefix && npm run build --prefix client”
    }
    For building, I’m using npm run build as my build command, and npm start for starting the application.

Despite these precautions, the deployment fails with the aforementioned error.

Your help on resolving this issue would be greatly appreciated!

Hi there,

In order for us to get into specific details about your service, I recommend reaching out to us privately via the “Help” link in the Dashboard. Be sure to select the specific service you are referring to here.

Regards,
Mike


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