I’ve been sent here by the *** AI who has told me to post the following after some 3 hours of failing to fix it.
The issue is a module resolution mismatch occurring during the build process of your CRACO setup.
Problem Description:
Issue: Deployment is failing with Command "npm run build" exited with 1.
Primary Error: A requireStack error during build, indicating an issue loading modules related to @craco/craco and Webpack dependencies (ajv-keywords, schema-utils, terser-webpack-plugin).
Context: Project created using Emergent, with the frontend located in a subdirectory of a GitHub repository.
Configuration Changes Already Made:
Root Directory: Set to frontend
Build Command: Set to npm run build
Install Command: Set to npm install --legacy-peer-deps --force
Node.js Version: Set to 20.x (updated from 24.x)
Error Logs:
‘/vercel/path0/frontend/node_modules/ajv-keywords/dist/keywords/index.js’,
‘/vercel/path0/frontend/node_modules/ajv-keywords/dist/index.js’,
‘/vercel/path0/frontend/node_modules/schema-utils/dist/validate.js’,
‘/vercel/path0/frontend/node_modules/schema-utils/dist/index.js’,
‘/vercel/path0/frontend/node_modules/terser-webpack-plugin/dist/index.js’,
‘/vercel/path0/frontend/node_modules/react-scripts/config/webpack.config.js’,
‘/vercel/path0/frontend/node_modules/@craco/craco/dist/lib/cra.js’,
‘/vercel/path0/frontend/node_modules/@craco/craco/dist/scripts/build.js’
Node.js v20.20.2
Error: Command “npm run build” exited with 1
This looks more like a dependency tree / lockfile problem than a Vercel platform problem, especially because the stack goes through @craco/craco, react-scripts, schema-utils, terser-webpack-plugin, and ajv-keywords.
I’d try to reproduce it from a clean install inside the same folder Vercel is building:
cd frontend
rm -rf node_modules
npm ci
npm run build
If npm ci fails, your package.json and package-lock.json are probably out of sync. In that case run this locally, commit the updated lockfile, then redeploy:
cd frontend
npm install
npm run build
git add package-lock.json package.json
git commit -m "Fix frontend dependency lockfile"
I’d also avoid npm install --legacy-peer-deps --force as the long-term install command if possible. It can get the build past peer dependency warnings but may also produce a dependency tree that is different from what CRACO/react-scripts expects. If the project genuinely needs legacy-peer-deps, I’d put this in frontend/.npmrc and commit it:
legacy-peer-deps=true
Then use a normal install command or let Vercel auto-detect it.
For this specific stack, this command should show whether ajv / ajv-keywords versions are mismatched or missing:
cd frontend
npm ls @craco/craco react-scripts ajv ajv-keywords schema-utils terser-webpack-plugin
If the first real error line says something like Cannot find module 'ajv/dist/compile/codegen', then I’d focus on fixing the ajv / ajv-keywords dependency versions rather than changing Vercel settings. The useful thing to share here would be the first 10–20 lines above the require stack, because that usually contains the actual missing module name.
Sadly I am the sort of newbie at whom codeless webs/apps is directed and the technical stuff below is way over my head and so I’ll have to give this up and start again with someone other than emergent.
I suspect it may just be an emergent device to persuade people to compile/host on their platform but fighting my way through the techno stuff is just not for me
Totally fair — that kind of npm/CRACO error is a rough place to start, especially if the goal was “no-code”.
Before you abandon the project completely, there may be one lower-tech option: ask Emergent to export or regenerate the app with a simpler modern frontend setup instead of CRACO / Create React App. For example, something like:
Please remove the CRACO/Create React App setup and convert this frontend to a standard Vite React app that can deploy on Vercel. Keep the UI and app behavior the same. Make sure `npm install` and `npm run build` work from the `frontend` directory without using `--force` or `--legacy-peer-deps`.
The key thing is not really “Vercel vs Emergent” here — it’s that the generated project has an older/dependency-sensitive build setup, and Vercel is exposing that during a clean production build.
If you do decide to try once more, the simplest success check is: does npm run build work inside the frontend folder before deploying? If not, the project still needs to be fixed or regenerated by the tool that created it.