docker-magento icon indicating copy to clipboard operation
docker-magento copied to clipboard

chmod: cannot access 'bin/magento': No such file or directory

Open jaywtc opened this issue 2 years ago • 34 comments

When installing Magent0 2.4.3 p1

setup like bin/setup magento.test

it showing this error

jaywtc avatar Jul 06 '22 14:07 jaywtc

Work-around on WSL 2 Ubuntu for me.

  1. docker exec -it magento-phpfpm-1 bash
  2. composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.3 .
  3. mv project-community-edition/* . Note: Not sure if needed, I may have missed the . off the end of the composer install.
  4. exit
  5. bin/magento

LiamKarlMitchell avatar Jul 07 '22 17:07 LiamKarlMitchell

Work-around on WSL 2 Ubuntu for me.

1. `docker exec -it magento-phpfpm-1 bash`

2. `composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.3 .`

3. `mv project-community-edition/* .`
   Note: Not sure if needed, I may have missed the . off the end of the composer install.

4. `exit`

5. `bin/magento`

Cheers for this. I had this issue too, and this seemed to work. To clarify it a bit so that others running into this issue might use it: This seems to happen when you install 2.4.3 - on 2.4.4 it works fine.

For your first command, replace magento-phpfpm-1 with your actual docker name you can get by running docker container ls. In my case it was docker_phpfpm_1, so I ran docker exec -it docker_phpfpm_1 bash. This logs you in to the bash shell of the docker image.

With your second command you essentially re-clone the magento install into here, I ran into issues that the folder wasn;t empty so I created a new directory (mkdir temp && cd temp) and ran it from there. After that I copied the folders content to the main directory by running cd ../ (to go back to the root directory), cp -r temp/* . and then remove the temp folder. Then exit and bin/magento worked!

Asitis avatar Jul 15 '22 10:07 Asitis

Thanks for posting this info. I'll try to finally do an install of docker-magento on Linux after I tag & publish the next version to make sure the README is still correct. Definitely willing to take in any updates to it if needed.

markshust avatar Jul 19 '22 16:07 markshust

Thanks Mark, if you could drop a message here when the next version is up, perhaps I can try it on weekend :)

LiamKarlMitchell avatar Jul 20 '22 07:07 LiamKarlMitchell

Reproducing bug for 2.4.3-p2 with curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.3-p2. Could not reproduce fix...

myselfhimself avatar Jul 20 '22 10:07 myselfhimself

@myselfhimself can you please post your full operating system & host details? Everything works fine for me on macOS, so it'll be very hard/impossible to confirm this is even an issue without all of the debugging details.

markshust avatar Jul 20 '22 11:07 markshust

@markshust I moved to the 2.4.4 install myself because that works fine out of the box - but I believe there is something off when loading Magento into the docker file, possibly related to permission errors that are not reproducable on macOS, as read here. With my 2.4.4 install I also had some permission issues (see other issue I closed recently), that I got fixed after reading that article.

For me this happened on Ubuntu 22.04 LTS, fresh install.

Asitis avatar Jul 20 '22 11:07 Asitis

Thanks! I have limited time coming up, but will definitely accept any PRs related to this issue.

markshust avatar Jul 20 '22 11:07 markshust

@myselfhimself can you please post your full operating system & host details? Everything works fine for me on macOS, so it'll be very hard/impossible to confirm this is even an issue without all of the debugging details.

Micro-Star International Co., Ltd. MS-7D25
32,0 GiB
12th Gen Intel® Core™ i7-12700K × 20
Ubuntu 22.04 LTS
64-bit
--
Docker version 20.10.17, build 100c701

myselfhimself avatar Jul 20 '22 12:07 myselfhimself

@myselfhimself can you please post your full operating system & host details? Everything works fine for me on macOS, so it'll be very hard/impossible to confirm this is even an issue without all of the debugging details.

Micro-Star International Co., Ltd. MS-7D25
32,0 GiB
12th Gen Intel® Core™ i7-12700K × 20
Ubuntu 22.04 LTS
64-bit
--
Docker version 20.10.17, build 100c701

Reproduced bug again, but managed to reproduce fix https://github.com/markshust/docker-magento/issues/731#issuecomment-1177943527 by @LiamKarlMitchell

myselfhimself avatar Jul 20 '22 12:07 myselfhimself

Are there any errors occurring when running bin/setup? If so and you can post the full output, we can try to find out what is going on. Manually cloning out the project within the Docker container shouldn't be needed.

markshust avatar Jul 20 '22 12:07 markshust

Are there any errors occurring when running bin/setup? If so and you can post the full output, we can try to find out what is going on. Manually cloning out the project within the Docker container shouldn't be needed.

See attachment magento-2.4.3-p2-install-setup-errors.txt

myselfhimself avatar Jul 20 '22 12:07 myselfhimself

@myselfhimself appreciate it.

It appears this issue is related to Composer:

  - Installing dealerdirect/phpcodesniffer-composer-installer (v0.7.2): Extracting archive
dealerdirect/phpcodesniffer-composer-installer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins
You can run "composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)
  - Installing magento/composer-dependency-version-audit-plugin (0.1.1): Extracting archive
magento/composer-dependency-version-audit-plugin contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins
You can run "composer config --no-plugins allow-plugins.magento/composer-dependency-version-audit-plugin [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)
  - Installing magento/composer-root-update-plugin (2.0.2): Extracting archive
magento/composer-root-update-plugin contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins
You can run "composer config --no-plugins allow-plugins.magento/composer-root-update-plugin [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)
  - Installing magento/inventory-composer-installer (1.2.0): Extracting archive
magento/inventory-composer-installer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins
You can run "composer config --no-plugins allow-plugins.magento/inventory-composer-installer [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)
  - Installing magento/magento-composer-installer (0.3.0): Extracting archive
magento/magento-composer-installer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins
You can run "composer config --no-plugins allow-plugins.magento/magento-composer-installer [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)

...and can be solved with: https://magento.stackexchange.com/questions/352353/why-composer-install-is-asking-to-allow-plugins

So, I think we just need to update the Linux README to include this step in the process? If someone on Linux can verify it, that would be extremely helpful. Here's a link to the Linux part of the readme: https://github.com/markshust/docker-magento#linux

markshust avatar Jul 20 '22 13:07 markshust

Obviously the fix was added in Magento 2.4.4 dev in January 2022 per this issue... Since I am trying to install Magento 2.4.3-p2 for stability reasons with a given set of modules... this would mean that the oneliner be corrected or to resort to a manual install with some manual change between some command line. That manual change could indeed be listed in the docker-magento readme. Will look into it to contribute a README patch tomorrow hopefully.

myselfhimself avatar Jul 20 '22 15:07 myselfhimself

@markshust The wise paths to fix in order to keep the docker-magento oneliner install script mostly automated would be to ask Magento 2's upstream project to add that composer.json fix to Magento <2.4.4 releases (asking now) or to induce the composer executable call to non-interactively accept all unsafe dependencies with some --force flag if that exists.

myselfhimself avatar Jul 21 '22 07:07 myselfhimself

@markshust On the non-interactive composer call strategy, according to https://magento.stackexchange.com/a/357508/105860, docker-magento's composer call could benefit from this config call first, which would allow Magento 2's < 2.4.4 to keep installing without asking questions:

composer config --no-plugins allow-plugins.magento/magento-composer-installer true
composer config --no-plugins allow-plugins.magento/inventory-composer-installer true
composer config --no-plugins allow-plugins.laminas/laminas-dependency-plugin true

Would you see this fit for adding to the docker-magento one-liner ?

myselfhimself avatar Jul 21 '22 07:07 myselfhimself

@myselfhimself absolutely, thanks so much for the lines! That made it easy for me. This shouldn't adversely affect any version of M2.

Can you confirm that it works now?

markshust avatar Jul 25 '22 13:07 markshust

@markshust Thanks for that patching!

Those lines should ideally be run before the composer create-project downloading call in the bin/download script: https://github.com/markshust/docker-magento/blob/f81cfc4d35574a4a7eb0aa61a9cb94fe0e2a450d/compose/bin/download#L24 while you have put them in the bin/setup script, which runs after bin/download in the onlinesetup script

I will test your PR tomorrow anyways, I may be mistaken in that too-late placement assumption.

myselfhimself avatar Jul 25 '22 21:07 myselfhimself

Just proposed a PR will the 3 lines located in bin/download instead before the composer create-project line

#741 seems to a duplicate of this. Asked submitter to try out that PR. Will try it out too on a faster computer...

myselfhimself avatar Jul 25 '22 21:07 myselfhimself

@markshust The PR needs your approval to run Github Actions tests

myselfhimself avatar Jul 25 '22 21:07 myselfhimself

You'll probably best add the --no-install flag to the create-project command, after that add the allowed plugins, and finally call composer install

I think in the way suggested with https://github.com/myselfhimself/docker-magento/commit/6a2fb7e0cc3d959ce7d5a383a27197ba48687d62, it won't work.

Also see https://github.com/composer/composer/issues/10928#issuecomment-1181534484

I would strongly suggest to only apply these changes for Magento versions >= 2.3.7 and < 2.4.4 if that's possible, reasons:

  • Magento 2.3.7 was the first version to support composer version 2 and this allowed plugins is only part of composer v2 and not composer v1
  • Magento 2.4.4 comes with this allowed-plugins configuration built-in. And those plugins might change again in the future, so applying those for future versions sounds like a bad idea

hostep avatar Jul 26 '22 12:07 hostep

@hostep Thank you, I improved the PR with your 3-steps suggestion (composer create project with no-install flag, add 3 allowances for magento-related dependencies, composer install fully)

We could either integrate the >= 2.3.7 to < 2.4.4 filter in that PR or a new one, once the current PR is merge.

myselfhimself avatar Jul 26 '22 15:07 myselfhimself

To me the PR is OK, tested manually locally (using the github CLI tool named gh) without the >= 2.3.7 to < 2.4.4 filter yet:

gh repo clone markshust/docker-magento docker-magento73126072000_b
cd docker-magento73126072000_b
gh pr checkout 742
rm -rf .git
bash lib/template
#paste https://github.com/myselfhimself/docker-magento/blob/patch-1/compose/bin/download 's contents into bin/download
bin/download 2.4.3-p2
bin/setup magento.test

# open https://magento.test

myselfhimself avatar Jul 26 '22 16:07 myselfhimself

Thanks or your response @myselfhimself

I'm getting an error trying to checkout 742

❯ gh pr checkout 742 could not determine base repo: fatal: not a git repository (or any of the parent directories): .git /usr/bin/git: exit status 128

Also, getting an error (without checkout?) while running bin/setup

chmod: cannot access 'bin/magento': No such file or directory

jsjsvsvs avatar Jul 26 '22 21:07 jsjsvsvs

Apologies, I just added a cd line after the gh clone to fix your first error.. (in the above comment)

myselfhimself avatar Jul 26 '22 21:07 myselfhimself

I believe I may be getting the same error (but there might be a step that is incorrect)

docker-magento73126072000_b on  master [?] took 2s ❯ #paste https://github.com/myselfhimself/docker-magento/blob/patch-1/compose/bin/download 's contents into bin/download

docker-magento73126072000_b on  master [?] ❯ bin/download 2.4.3-p2 [+] Running 7/7 ⠿ Container docker-magento73126072000_b-db-1 Started 0.8s ⠿ Container docker-magento73126072000_b-redis-1 Started 2.0s ⠿ Container docker-magento73126072000_b-rabbitmq-1 Started 1.9s ⠿ Container docker-magento73126072000_b-app-1 Started 2.1s ⠿ Container docker-magento73126072000_b-elasticsearch-1 Started 0.8s ⠿ Container docker-magento73126072000_b-mailcatcher-1 Started 1.9s ⠿ Container docker-magento73126072000_b-phpfpm-1 Started 2.0s Composer auth has already been set up. Fixing filesystem ownerships... Filesystem ownerships fixed. magento/magento-composer-installer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins You can run "composer config --no-plugins allow-plugins.magento/magento-composer-installer [true|false]" to enable it (true) or keep it disabled and suppress this warning (false) magento/inventory-composer-installer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins You can run "composer config --no-plugins allow-plugins.magento/inventory-composer-installer [true|false]" to enable it (true) or keep it disabled and suppress this warning (false) laminas/laminas-dependency-plugin contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins You can run "composer config --no-plugins allow-plugins.laminas/laminas-dependency-plugin [true|false]" to enable it (true) or keep it disabled and suppress this warning (false) dealerdirect/phpcodesniffer-composer-installer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins You can run "composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer [true|false]" to enable it (true) or keep it disabled and suppress this warning (false) magento/composer-dependency-version-audit-plugin contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins You can run "composer config --no-plugins allow-plugins.magento/composer-dependency-version-audit-plugin [true|false]" to enable it (true) or keep it disabled and suppress this warning (false) magento/composer-root-update-plugin contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins You can run "composer config --no-plugins allow-plugins.magento/composer-root-update-plugin [true|false]" to enable it (true) or keep it disabled and suppress this warning (false) Creating a "magento/project-community-edition=2.4.3-p2" project at "./"

[InvalidArgumentException] Project directory "/var/www/html/." is not empty.

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [] [] []

docker-magento73126072000_b on  master [?] took 21s ❯ bin/setup magento.test [+] Running 7/7 ⠿ Container docker-magento73126072000_b-db-1 Stopped 1.9s ⠿ Container docker-magento73126072000_b-rabbitmq-1 Stopped 6.6s ⠿ Container docker-magento73126072000_b-redis-1 Stopped 0.4s ⠿ Container docker-magento73126072000_b-mailcatcher-1 Stopped 0.4s ⠿ Container docker-magento73126072000_b-elasticsearch-1 Stopped 1.8s ⠿ Container docker-magento73126072000_b-phpfpm-1 Stopped 0.5s ⠿ Container docker-magento73126072000_b-app-1 Stopped 1.2s [+] Running 7/7 ⠿ Container docker-magento73126072000_b-app-1 Started 1.2s ⠿ Container docker-magento73126072000_b-redis-1 Started 1.1s ⠿ Container docker-magento73126072000_b-rabbitmq-1 Started 0.4s ⠿ Container docker-magento73126072000_b-mailcatcher-1 Started 1.2s ⠿ Container docker-magento73126072000_b-phpfpm-1 Started 1.1s ⠿ Container docker-magento73126072000_b-elasticsearch-1 Started 1.1s ⠿ Container docker-magento73126072000_b-db-1 Started 1.0s chmod: cannot access 'bin/magento': No such file or directory

jsjsvsvs avatar Jul 26 '22 22:07 jsjsvsvs

You should stop your previously created running docker images between attempts (so, basically now) with: bin/stopall

Also each new attempt would need a new directory.. So: gh repo clone markshust/docker-magento docker-magento73126072000_b # put a different directory name here and cd docker-magento73126072000_b #same directory name as before or just cd $_

myselfhimself avatar Jul 27 '22 07:07 myselfhimself

@hostep I added version filtering to the PR as you recommended. Needs testing.

myselfhimself avatar Jul 28 '22 07:07 myselfhimself

is there any news?

when i try to install 2.3.4 i receive this error and nothing happens after that

`docker exec -it d7124a76465cca995dee2bcc7eaa68dfce124a6029b80a004aeb7554ea0f7364 /bin/sh $ composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.3.4 Creating a "magento/project-community-edition=2.3.4" project at "./project-community-edition" Installing magento/project-community-edition (2.3.4)

  • Installing magento/project-community-edition (2.3.4): Extracting archive Created project in /var/www/html/project-community-edition Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1 - Root composer.json requires magento/product-community-edition 2.3.4 -> satisfiable by magento/product-community-edition[2.3.4]. - magento/product-community-edition 2.3.4 requires php ~7.1.3||~7.2.0||~7.3.0 -> your php version (7.4.29) does not satisfy that requirement. Problem 2 - Root composer.json requires dealerdirect/phpcodesniffer-composer-installer ^0.5.0 -> satisfiable by dealerdirect/phpcodesniffer-composer-installer[v0.5.0]. - dealerdirect/phpcodesniffer-composer-installer v0.5.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.2.0] but it does not match the constraint. Problem 3 - Root composer.json requires magento/magento2-functional-testing-framework 2.5.3 -> satisfiable by magento/magento2-functional-testing-framework[2.5.3]. - magento/magento2-functional-testing-framework 2.5.3 requires php 7.0.2||7.0.4||~7.0.6||~7.1.0||~7.2.0||~7.3.0 -> your php version (7.4.29) does not satisfy that requirement.`

ChristianTestUser avatar Aug 04 '22 07:08 ChristianTestUser

I resolved this issue with adding these lines the on bin/download file;

bin/clinotty composer create-project --repository=https://repo.magento.com/ magento/project-"${EDITION}"-edition="${VERSION}"  . --no-install


echo "Adding Magento modules to Composer allow-plugins directive..."
bin/clinotty composer config --no-plugins allow-plugins.magento/magento-composer-installer true
bin/clinotty composer config --no-plugins allow-plugins.magento/inventory-composer-installer true
bin/clinotty composer config --no-plugins allow-plugins.laminas/laminas-dependency-plugin true

bin/clinotty composer update

#754

anilacikgoz avatar Aug 10 '22 08:08 anilacikgoz