vendor : how to go back to an old version of packages?
After a few changes in my code, I added/updated packages to my vendor and committed everything to a working branch through git, since then my new elements works, but some of my old stuff (that are way more important) doesn't works at all.
I'd like to come back to an old version of my code. I cloned my master branch in a new directory, my new elements are not there (normal) but old stuff doesn't works.
I don't know much about vendor nor Laravel so maybe I misunderstand something.
Is there a way to come back to a working version of my code and getting my old vendor package? Or maybe just an update of all the package could fix that?
I'm really talking about vendor, I got my old dev code through my master branch.
You can set the version of the different packages in your composer.json file. Just set it/them to a specific version so it won't update it so you can lock it in and composer update
so instead of something like
"barryvdh/laravel-ide-helper": "^2.4",
you could
"barryvdh/laravel-ide-helper": "2.4",
and it will always stay at version 2.4.
If you commit your composer.lock file to git (always good to do), you should also be able to backtrack that and see what versions things were through time.
Thanks guys for your answers.
What I did was to download a full old project on my git (that was working), with the vendor.
It still doesn't works.
Since then, I don't really know what could be the issue(s).
The online version works, the one on my computer, using apache2, doesn't.
Right now, I'm not even sure that the problem comes from the vendor...
What doesn't work:
When I click on a button, it should send some information to a database, and then show the information just sent on the page. Right now it's going to the page but no informations are sent and nothing is shown on the page. I've no error at all.
I tried with the old vendor, not working, then I deleted the vendor, run composer install, still not working.
I doubt that is related to composer. It could also be a frontend issue. But it can be a thousand of reasons why this is not working anymore. Did you do any yarn install / update or npm install / update ?
Alternative approach: Go back to in your git history and figure out since when it ain't working anymore.
@m-rk I remember I did a npm install or update at a moment during my work yes.
Could it be the issue? Some updated files that doesn't work with a previous version? Is there anything I can do about that?
I was working on a working branch and never merged it to the master branch.
When I download the master's project and run it, it doesn't work.
That's what made me think maybe it's not the vendor but something else.
As I said, it can be a thousands of reasons. We can't see your code or screen from here. But yes if you run npm update it is going to update all of your javascript dependencies to the latest version. Equal to composer update. Depending on your setting in package.json it is going to update to a (major/minor/hotfix) version. Javascript libraries are not always using semver in a correct way so even a minor upgrade could break your code. I don't know if this is the case for you but it could be.
If you have a recent version of npm (or yarn) you should have a package-lock.json or yarn.lock file in the root directory. If so, you should be able to revert it back to the one that worked. Run again npm install and it should revert your frontend third party libraries. If you don't have such a lock file for npm packages... I don't know how/if you could revert this nicely.
But maybe the reason is something completely different. You need to give more detailed information if you want our help. Do you see errors somewhere? In your console? Are you using third party packages that are submitting your form? Ajax requests? Etc. etc. etc.
I had no error message until this morning.
I tried to change my working branch and to get back to my master branch in PHPStorm.
When doing this I got the error 'Couldn't checkout to master, unable to unlink old "vendor/barryvdh/laravel-cors/composer.json" '
I look into it and compared it to an old one and only one line change:
In my NEW one I have : "dev-master": "0.9-dev"
In my OLD one I have: "dev-master": "0.10-dev"