So I a deployed a Node.js website to Heroku earlier (through Github) and today I made a few changes. I did the same git add . git commit -m 'changes' git push commands but the website on Heroku hasn't changed. Automatic deploys are ON. The code on my Github changed and is correct.
I also used git push heroku master and heroku config:set NODE_MODULES_CACHE=false , it doesn't update the code. Website still the same, like at first deploy.
Also did purge cache.
heroku releases checks out. And I checked the file with heroku bash on the Heroku servers, the file is also updated there. Still, I can't see the changes on the website. Tried different browsers, phones, incognito... And I only use master branch.
FIXED IT:
npm run build in the client folder. Even though I did it already before my first deploy, have to do it again after the changes. Then you can push, commit, deploy, whatever...
Related
Currently whenever I make a change to some code I do the following in terminal:
git init
git add .
git commit -m "Some changes"
git push heroku master
I am not 100% certain, but this seems like it is redeploying the entire project and installing all packages again. If this is the case is there a way to only push the changes made?
For example, if I change one line of code, I just want to push that one file with the change, not the entire project again.
It depends how you're packaging the app, e.g. with webpack.config. Typically you'd package and deploy the entire project to the server each time. This is the correct way to do it (rather than just trying to replace one file), so that you can do project-wide actions like minifying code, processing your CSS, etc. The server would not download/install external packages that are already there unless you specify a different version in your package.json file.
git init only be oncethen every time you make a change just run
git add. (add all changes)
git commit -m "commit"
git push origin master
It's because react has to do some of its magic before Heroku can deploy it properly. That magic includes installing the node modules, compiling all the source files, and then optimizing everything before outputting the build folder with everything in it. There's not a 1:1 relationship between the one line in one file you changed and the build output - react requires a re-build.
I run:
heroku create
and
git push heroku master
Everything Ok, but when I try to view logs, heroku show:
npm ERR! missing script: start
But, in package.json. I have defined script start.
I tried clone source code on heroku/master, It's not my code, it contains only .gitignore, package.json, README.md ....
I try push code to heroku again, it always show everything up-to-date
If it's not your code, you need to ensure if you are looking at correct heroku repo. If it is earlier version of your code, see if git push is actually working without errors and pushing to correct repo and branch being used in heroku. Your code should be pushed to master branch (by default) on Heroku.
I have made changes to some css and js file in my Node-React apllication which is deployed on Heroku. But the changes are not showing up when I git add . the project on heroku. ALthough the changes are not coming up when I run the project locally.
Any help would be appreciated on what could be the possible cause on the changes not getting deployed?
You need a few more commands in your deployment workflow.
The git add . command is putting your local changes into staging.
You also need to run git commit -m 'your commit message' in order to commit those local changes to your local git repository.
Next, you need to run git push to push your local repository to the remote repository it is linked with.
Effective use of git is one of the most useful things you can teach yourself as a developer. It will enable you to contribute effectively to a team when the time comes. Here's a good starter article: Basic Git With Examples.
I am new to Heroku. Recently I created a NodeJS application with the Heroku git and deployed it on Heroku. I used the following command to clone the repository to my local computer from the Heroku git.
heroku git:clone -a {app_name}
How would I be able to browse the repository on the Heroku git rather than locally, like GitHub?
In your heroku account, go to your app -> Settings.
Under App Information, you'll find the heroku git url.
How would I be able to browse the repository on the Heroku git rather than locally, like GitHub?
You don't.
Heroku is a platform as a service hosting provider, not a repository host. You can clone from it, but that's not what it's designed to do:
Heroku provides the git service primarily for deployment, and the ability to clone from it is offered as a convenience. We strongly recommend you store your code in another git repository such as GitHub and treat that as canonical.
It doesn't provide a web interface to its Git repositories.
I am managing a dependency at Github which I use as a dependency in my project. I placed the dependecy as a tarball link (viz. https://github.com/username/dependecy/tarball/master) into the package.json and it is working fine as expected locally. When I update the package at Github I can run a npm install and all dependencies including the Github tarballs get updated. However it is not the case at Heroku. tarball-linked dependencies does not get updated. Any ideas?
I had the similar problem. My App had the dependency with caret versioning like this:
"dependency": "^0.6",
So every time the dependency got its patch version updated, I wanted Heroku to have the updated dependency without any commits/pushes to my App. For that I set just in case
heroku config:set NODE_MODULES_CACHE=false
And when the new patch version became available I did the manual redeploy of the same App that was already deployed from Heroku Dashboard.
Can you try to do the same for your case? Possibly this will help you.
Since no one has answered this yet I will share what I have learned. The trick is getting heroku to think the tarball is different or new so that it downloads it again. As #celalo suggested you can remove it or change the path, commit, push, change it back, commit and push. This is messy but it works.
What I ended up doing was making a master1 branch. I keep the branch in sync with master and then alternate the tarball url between master and master1 when I need it to update.