Skip to content

Instantly share code, notes, and snippets.

@adamzero1
Last active February 23, 2022 10:26
Show Gist options
  • Save adamzero1/0eb6d3e14078676a3ba589d77ba67b3d to your computer and use it in GitHub Desktop.
Save adamzero1/0eb6d3e14078676a3ba589d77ba67b3d to your computer and use it in GitHub Desktop.
Fix broken Magento2 install

Description

Sometimes when running composer install for Magento 2 depending on your current directory structure the Magento composer plugin does not extract/copy the files out of vendor. Which leaves you with a broken installation.

How to run

curl -s https://gist.githubusercontent.com/adamzero1/0eb6d3e14078676a3ba589d77ba67b3d/raw/6ed67290b6eca7211942d1363ab6115eefd590a6/fix | bash
#!/bin/bash -xe
for directory in vendor/magento/*; do
if [[ -d "${directory}" ]]; then
if [[ "${directory}" != *"composer"* ]]; then
echo -n "removing ${directory}";
rm -rf ${directory};
echo "OK";
fi
fi
done
echo "reinstalling composer packages";
composer install --no-dev;
echo "done";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment