4

I have a project running on Magento 2.1.4, I have the bare minimum needed stored in a Git Repo, which I can clone and run composer install & php bin/magento setup:upgrade and all works fine; it generates all the files needed to run Magento 2. - I know this definitely works, it is how my live site has been deployed, and it is how I have been doing it since Magento 2.1.0.

Now I have gone to upgrade Magento from 2.1.4 to 2.1.7 (Latest version at time of writing). To do this all I am doing is changing my composer.json file from "magento/product-community-edition": “2.1.4” to "magento/product-community-edition": “2.1.7” and then running composer update & php bin/magento setup:upgrade.

Doing the above on my Magento 2 site that is already up and running works fine. My problem arises when I take a fresh copy from my repo, change the composer.json file and run composer update & php bin/magento setup:upgrade.

composer update works fine, but when I try running php bin/magento setup:upgrade I get the following error:

PHP Warning: require(/***/***/***/***/***/bin/../app/bootstrap.php): failed to open stream: No such file or directory in /***/***/***/***/***/bin/magento on line 14

I can see that the bootstrap.php file is missing from the app folder, along with many other files and folders.

I have tried upgrading to 2.1.5 & 2.1.6 as well, but the same thing happens. This does not happen when installing 2.1.4, all files and folders are generated correctly.

I have cleared my composer cache incase anything was wrong with it, but this has made no difference. I have also searched Google, Magento Forums and Stack Overflow for answers but cannot seem to find anything.

2 Answers 2

5

I ran into this today. The problem appears to be that during the installation process (at least in my case) an exception is triggered during the file creation. This exception is suppressed unless the verbose mode of composer is installed: composer install -vvv. In my case, it appears to be attempting creation of a directory on top of the symlink:

mkdir(): File exists

Debugging the following function, the error is clearer: https://github.com/magento/magento-composer-installer/blob/master/src/MagentoHackathon/Composer/Magento/DeployManager.php#L97

# Args: 
# 0 ${APP_ROOT}/./pub/media/theme_customization
# 1 511
# 2 true # <-- Probably the problem

The line that appears to trigger the exception is: https://github.com/magento/magento-composer-installer/blob/master/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php#L35

Hooking an strace to that process while debugging shows the following:

stat("${DOCROOT}/pub/media", 0x7ffe47435c90) = -1 ENOENT (No such file or directory)
stat("${DOCROOT}/pub", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
mkdir("${DOCROOT}/pub/media", 0777) = -1 EEXIST (File exists)

In my case, I use a symlink for the media folder to persist it during releases (even during local dev). The recursive argument of PHP appears to be attempting to mkdir for that path, and failing.

The resolution (for me at least) was to just remove symlinks during the initial install:

find . -type l -exec rm {} \;

After that, it worked ok. Lodged https://github.com/magento/magento2/issues/10292

0

i am also facing this issue while upgrading 2.4.2 -> 2.4.3. Composer update works fine but i can see that app/bootstrap.php and app/autoload.php files are deleted after upgrade. I do not see anything in error logs. I have tried almost 10 times. Each time same issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.