Comments (9)
I just want to share my experience on this, took me a while to figure out.
Open up the client directory, not in visual studio but in windows folder, go to view and check show hidden folder, git folder will appear, delete it, cut and paste the entire client folder outside the main directory, then go back to command in visual studio, do the following
- Git add .
- Git commit -m "some comment"
After adding and committing without the client folder, cut and paste back the client folder to where it was, and do the following.
- Git init (not sure if this is necessary but I did it)
- heroku git:remote -a ... (the message for setting heroku remote)
- Git add .
- Git commit -m "some comment"
- Git push heroku master
As to why this error occurred I don't know, apparently it's got to do with having two git folders in main and client directory, each one gets created but perhaps intrinsically different? The solution seems to be getting rid of the git folder in the sub directory, keep the one in main directory, and do the above steps to make it work.
Apparently just simply deleting the git folder isn't enough, you have to move the client folder outside once, and move it back to the exact same location, and Git Add Git Commit.
from mern_shopping_list.
Check to see if you have git installed in the client directory as well as the root directory. I believe create-react-app sets up git in the client folder. But to push to heroku git needs to be in the root folder. This wasn't made clear in the videos.
from mern_shopping_list.
remote: npm ERR! [email protected] heroku-postbuild: NPM_CONFIG_PRODUCTION=false npm install --prefix-client && npm run build --prefix client
you first prefix must be : npm install --prefix client
without the -
And yes, remove the .git folder created by create-react-app if you have one
from mern_shopping_list.
Thanks man , You are a life saver!
from mern_shopping_list.
Thanks a lot!!!!!!!!!!!!!!!!!!!!!
from mern_shopping_list.
Thankyou so much, it really works man !
from mern_shopping_list.
Thanks a lot!!! you saved my project
from mern_shopping_list.
@dulerong Please review my code, I followed what you suggested but it is still not working. Please Please help. getting below err
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 16.x...
remote: Downloading and installing node 16.15.1...
remote: Using default npm version: 8.11.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: added 211 packages, and audited 212 packages in 4s
remote:
remote: 29 packages are looking for funding
remote: run npm fund
for details
remote:
remote: found 0 vulnerabilities
remote:
remote: -----> Build
remote: Running heroku-postbuild
remote:
remote: > [email protected] heroku-postbuild
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix frontent && npm run build --prefix frontend
remote:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_d76ff38e/frontent/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_d76ff38e/frontent/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.aguxs/_logs/2022-06-14T14_40_07_661Z-debug-0.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to blogsite77.
remote:
To https://git.heroku.com/blogsite77.git
! [remote rejected] master -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/blogsite77.git'
from mern_shopping_list.
Just amazing! It worked for me too! I used it with another project of my own and couldn't find the answer. @Diksha-11 follow ALL the steps as @dulerong mentioned, it works!
I've spent ALL DAY on this...but thanks again guys! And specially @dulerong I don't know how you found that answer, that was really amazing! Hugs!
from mern_shopping_list.
Related Issues (20)
- TypeError: Cannot set property 'x-auth-token' of undefined
- Build fails on deploying [Heroku] HOT 6
- proxy error HOT 1
- remove() is a deprecated function
- heroku post build failed. HOT 2
- this project does not run lot of issues
- What to do if I have frontend and backend in two different folder
- Line 97: { error: e.message } should be: {msg: e.message}
- NODE_ENV value of 'production' did not match any deployment config file names.
- Issue while deploying to heroku HOT 1
- user validation failed: password: Cast to string failed for value "Promise { <pending> }" at path "password" HOT 1
- PROXY error : Could not proxy request /api/auth/user from localhost:3000 to https://localhost:5000 HOT 1
- Items missing HOT 1
- cannot get /
- Errors when running project HOT 1
- App Deployment Issue
- Invalid Host header
- id can not be taken by errReducer
- Build failed on heroku
- Heroku cannot find the React index.html file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mern_shopping_list.