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:
- I’ve ensured that all the necessary development dependencies for Vite are listed in my
package.json
file. - I’ve double-checked the location of my
vite.config.js
file to make sure it’s in the correct directory. - 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 usingnpm run build
as my build command, andnpm 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!