Heroku is not updating my code?

后端 未结 12 1203
闹比i
闹比i 2020-12-15 23:33

So I did some CSS changes on my local, ran git add ., git commit -am \"Hello\", git push heroku master, and for some reason two commmi

相关标签:
12条回答
  • 2020-12-16 00:07

    If your domain uses Cloudflare DNS, try to "Purge Cache" from the Cloudflare account.

    0 讨论(0)
  • 2020-12-16 00:08

    If your code is correctly deployed as shown from heroku releases, you can try to purge the cache and force a fresh build. See https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache

    $ heroku plugins:install heroku-repo
    $ heroku repo:purge_cache -a appname
    

    The cache will be rebuilt on the next deploy.

    $ git commit --allow-empty -m "Purge cache"
    $ git push heroku master
    
    0 讨论(0)
  • 2020-12-16 00:11

    Try running:

    bundle exec rake assets:precompile
    

    Then gitting:

    git add . 
    git commit -m "asdfasdf" 
    git push heroku master
    
    0 讨论(0)
  • 2020-12-16 00:11

    I had this problem recently as well. If you've tried the main troubleshooting steps, it might be similar to what Brett84c said - the build process is not being followed properly.

    For example, this website recommends that you insert the following block of code into your backend express app's index.js file in order to serve static files from a pre-built folder.

    // ... other app.use middleware 
    app.use(express.static(path.join(__dirname, "client", "build")))
    
    // ...
    // Right before your app.listen(), add this:
    app.get("*", (req, res) => {
        res.sendFile(path.join(__dirname, "client", "build", "index.html"));
    });
    

    However, this means that you must ensure that the build folder it is serving that is located in the backend folder has actually been updated (re-built) each time you make changes to the "client" frontend React app.

    0 讨论(0)
  • 2020-12-16 00:12

    So I was trying to push my React app to Heroku and could not figure out why the code wasn't updating even though my original git repo showed the changes while I pushed that same code to Heroku directly after. Turns out I forgot to handle the building process for my app code first before committing the changes.

    0 讨论(0)
  • 2020-12-16 00:13

    Make sure your local branch is master. If you're using a different local brach then you have to use.

    git push heroku your_local_branch_name:master
    
    0 讨论(0)
提交回复
热议问题