I don't know the history of this site. Though it has a bunch of plugins and a custom module. I tried removing the vendor folder and running composer install. Though at this point I am flailing. I presume I need to create a fresh install folder and copy the data into it? Thanks!
1 Answer
Are you sure you're looking at the complete source code for the website? If you just have access to the production site, it's possible it may be missing source files, like the composer files. Not all deployment systems include the entire source code. If the site has been deployed using a build system that builds in a virtual machine – like GitHub Actions – and then uploads just the relevant build artefacts (like the vendor folder), those source files will never reach the production environment. If this is a case, there may be more files missing. For example, if the site includes a build step for JS / CSS assets and the production environment only includes minified assets, it will be nearly impossible to continue to develop the site without access to the original files.
First, do whatever it takes to get hold of the last developer who worked on the site. Ask them for access to the git repository, if it exists, or even just a zip file of their development version of the site. It's likely that those will include the files you're looking for.
If the composer.json
and composer.lock
files are really missing, you're going to have to reproduce them to be able to update the site cleanly and completely. Before you get started, take a full backup of the entire site, including the database, and install it in a local development environment.
You can use the composer.json
in the Craft project template as a starting point. Enter all the plugins you can see in the backend to the require
section. Then go through the vendor/
folder and check every package. For every package in there, check if it's already installed as a dependency of Craft or one of the plugins (composer why
can help with this). If it isn't, check if the site actually needs it. If so, add it to the require
section of the composer.json
as well. If not, you can safely remove it. Finally, remove the vendor/
folder and run composer install
, then check if everything works correctly. If not, compare the vendor folder to the one from the backup to see what's missing.
-
1Also - just in case your site was setup in a custom folder setup, take a look around in the root directory of the project for a composer.json file. If there is another developer also working on the project, see if they have a copy on their local setup.– cherrykoda ♦Commented Mar 7, 2023 at 4:56