Code Monkey home page Code Monkey logo

Comments (9)

dulerong avatar dulerong commented on August 23, 2024 36

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

  1. Git add .
  2. 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.

  1. Git init (not sure if this is necessary but I did it)
  2. heroku git:remote -a ... (the message for setting heroku remote)
  3. Git add .
  4. Git commit -m "some comment"
  5. 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.

jcopley avatar jcopley commented on August 23, 2024

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.

Seb6277 avatar Seb6277 commented on August 23, 2024

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.

Jalajj avatar Jalajj commented on August 23, 2024

Thanks man , You are a life saver!

from mern_shopping_list.

abhishek-shanu avatar abhishek-shanu commented on August 23, 2024

Thanks a lot!!!!!!!!!!!!!!!!!!!!!

from mern_shopping_list.

divyanshsikarwar avatar divyanshsikarwar commented on August 23, 2024

Thankyou so much, it really works man !

from mern_shopping_list.

keshav0114 avatar keshav0114 commented on August 23, 2024

Thanks a lot!!! you saved my project

from mern_shopping_list.

Diksha-11 avatar Diksha-11 commented on August 23, 2024

@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.

juliotrujilloh avatar juliotrujilloh commented on August 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.