Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Navigation

    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    SOLVED LAMP stack Composer: Cannot require any package, cannot write into cache

    LAMP
    lamp
    2
    4
    140
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jepster last edited by girish

      Hi,

      I have noticed that Composer comes pre-installed with the Cloudron LAMP stack. If I change into a terminal, I can use it by executing "composer". However, if I run the following command:

      root@5585a070-9420-4f84-bd98-5198b471ffb4:/app/data/public# composer require drush/drush
      Cannot create cache directory /root/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
      Cannot create cache directory /root/.composer/cache/files/, or directory is not writable. Proceeding without cache
      Do not run Composer as root/super user! See https://
      

      I see that Composer is not able to create its cache. Also it gets killed, when I try to require a package:

      root@5585a070-9420-4f84-bd98-5198b471ffb4:/app/data/public# composer require drush/drush
      Cannot create cache directory /root/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
      Cannot create cache directory /root/.composer/cache/files/, or directory is not writable. Proceeding without cache
      Do not run Composer as root/super user! See https://getcomposer.org/root for details
      Using version ^9.5 for drush/drush
      ./composer.json has been updated
      Cannot create cache directory /root/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
      Cannot create cache directory /root/.composer/cache/files/, or directory is not writable. Proceeding without cache
      Loading composer repositories with package information
      Updating dependencies (including require-dev)
      Killed
      root@5585a070-9420-4f84-bd98-5198b471ffb4:/app/data/public#
      

      What am I doing wrong? Is there an error on your end? Could not find any info about Composer usage. I need Composer for my PHP app.

      Kind regards
      Peter

      1 Reply Last reply Reply Quote 0
      • girish
        girish Staff last edited by

        The Killed at the end is because composer ran out of memory. By default, the package only has 256MB memory, increasing it should fix the problem.

        As for running composer as root, the packaging is to blame. I am looking into fixing this.

        1 Reply Last reply Reply Quote 0
        • girish
          girish Staff last edited by

          For reference, the killed issue is also documented here - https://github.com/composer/composer/issues/1815

          1 Reply Last reply Reply Quote 0
          • girish
            girish Staff last edited by

            @jepster We have pushed an update that should make it simpler now. Also updated the docs - https://cloudron.io/documentation/apps/lamp/#running-composer

            1 Reply Last reply Reply Quote 0
            • First post
              Last post