Code Monkey home page Code Monkey logo

Comments (12)

Bryce-Colton avatar Bryce-Colton commented on June 12, 2024 6

I tried ENV COMPOSER_ALLOW_SUPERUSER=1 in my DockerFile and it works like a charm.

Composer documentation :

COMPOSER_ALLOW_SUPERUSER#
If set to 1, this env disables the warning about running commands as root/super user. It also disables automatic clearing of sudo sessions, so you should really only set this if you use Composer as a super user at all times like in docker containers.

from api-platform.

mtovmassian avatar mtovmassian commented on June 12, 2024 3

Probably explained by this composer issue.

from api-platform.

Bryce-Colton avatar Bryce-Colton commented on June 12, 2024 1

Same issue encountered on project using api-platform v3.1 and symfony v6.3

It seems like the command composer install --no-progress --no-scripts --optimize-autoloader --prefer-dist --no-interaction executed, when building the production image, don't generate the file autoload_runtime.php required by the console.

composer require symfony/runtime generate the file.

From the symfony documentation :

If you use the Composer --no-plugins option, the autoload_runtime.php file won't be created.

If you use the Composer --no-scripts option, make sure your Composer version is >=2.1.3; otherwise the autoload_runtime.php file won't be created.

Here is the log of our gitlab CI :

#35 [stage-1 24/25] RUN composer install --no-progress --no-scripts --optimize-autoloader --prefer-dist --no-interaction
#35 0.320 Composer plugins have been disabled for safety in this non-interactive session. Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.

Maybe it is the root cause of this issue.

from api-platform.

RahulMikaelson avatar RahulMikaelson commented on June 12, 2024 1

@Bryce-Colton I have set ENV COMPOSER_ALLOW_SUPERUSER=1 in my DockerFile but i am still facing the issue.

from api-platform.

soyuka avatar soyuka commented on June 12, 2024

docker compose build --no-cache --pull

from api-platform.

axel37 avatar axel37 commented on June 12, 2024

Had the same error today, even after trying docker compose build --no-cache --build

from api-platform.

RobertoGarc1a avatar RobertoGarc1a commented on June 12, 2024

Has anyone found a solution to make it work?

from api-platform.

RahulMikaelson avatar RahulMikaelson commented on June 12, 2024

@RobertoGarc1a not sure it works or not, try to delete all the images and containers and run the commands mentioned in api platform docs. when the containers are up go to docker desktop and open api container wait until the logs of api container successfully installs all the package after try to open the localhost url. This has worked for me.

from api-platform.

dunglas avatar dunglas commented on June 12, 2024

Otherwise, try running composer install in the container.

from api-platform.

deoomen avatar deoomen commented on June 12, 2024

Adding ENV COMPOSER_ALLOW_SUPERUSER=1 work but is it recommended way now?

from api-platform.

dunglas avatar dunglas commented on June 12, 2024

Yes? But this env var should be there by default in the container.

from api-platform.

ludofleury avatar ludofleury commented on June 12, 2024

I just met the same issue on FrankenPHP, it's related to the vendor volume, somehow the composer install in the entrypoint didn't proc

I "fixed" it by simply enabling this https://github.com/api-platform/api-platform/blob/main/compose.override.yaml#L14

from api-platform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.