0

When I am trying to deploy my react chat project which is not based on backend and doesnt go into complications of web sockets and simply uses dummy data from another js file, the code of the app.js file is visible on the web page and the project doesnt get deployed properly. However, their is no complication shown by vercel. The only suspicious thing is my deployment link, it appears unusual, as I have deployed one more basic react project on vercel in past. Also, vercel doesnt automatically detect my project as a react project while trying to deploy it And never deploys when I choose create react app as my framework preset.Images:- The difference in the appearance of my project on vercelThis is how the project looks after deployment

I tried to deploy the app directly by just choosing my github repository of the project in vercel. But it didnt deploy my project properly even though it didnt show any error....

After knowing that my project missed a package.json file, I corrected it but now vercel has thrown new errors that I am listing below. I dont know whats wrong. Please help. I am giving all the details below....

Running build in Washington, D.C., USA (East) – iad1 Cloning github.com/gyanshivam/React-Chat-App (Branch: main, Commit: cfab724) Previous build cache not available Warning: Failed to fetch one or more git submodules Cloning completed: 493.284ms Running "vercel build" Vercel CLI 34.1.3 Installing dependencies... npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x. added 1449 packages in 26s 203 packages are looking for funding run npm fund for details npm notice npm notice New minor version of npm available! 10.5.0 -> 10.6.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.6.0 npm notice Run npm install -g [email protected] to update! npm notice Detected package-lock.json generated by npm 7+ Running "npm run build"

[email protected] build react-scripts build Could not find a required file. Name: index.js Searched in: /vercel/path0/src Error: Command "npm run build" exited with 1

1 Answer 1

0

Your repository seems to be missing the package.json file. This file identifies the project and lists the packages your project depends on, making your build reproducible. More info here.

You might have forgotten to upload the package.json while pushing your code to GitHub and that's the reason Vercel wasn't able to recognize your project as react and so it just serves the files as static files.

Sign up to request clarification or add additional context in comments.

4 Comments

Indeed it was missing but...
No worries enjoy coding🕺
I have edited the question because its not allowed to write big comments. Can you help with the newer issue that has come up now?
correct your files and directory structure. your index.js should be src folder, package.json in root dir etc etc. also try to run npm run build to check if it build locally properly before deploying.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.