0

So I'm getting the same error message for any module I try and install on my drupal8 enviroment. I've been shuffling files and folders around so I'm sure I've broken something.

Is there anywhere I can look in drupal log files for anymore help on the error or does someone know the cause of this error?

composer require drupal/Astrology
Using version ^1.4 for drupal/astrology
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing drupal/astrology (1.4.0): Loading from cache
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Writing lock file
Generating autoload files
29 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Installation failed, reverting ./composer.json to its original content.

                                            
  [RuntimeException]                        
  does not exist and could not be created.  
                                            

Here is the full composer.json file:

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 8 projects with a relocated document root",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "drupal/admin_toolbar": "^2.3",
        "drupal/bootstrap_barrio": "^5.1",
        "drupal/coffee": "^1.0",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8",
        "drupal/devel": "^4.0",
        "drupal/entity_delete": "^1.6",
        "drupal/feeds": "^3.0@alpha",
        "drupal/feeds_tamper": "^2.0@beta",
        "drupal/flexslider_fields": "^2.0",
        "drupal/fontawesome": "^2.17",
        "drupal/gdoc_field": "^1.1",
        "drupal/migrate_plus": "^5.1",
        "drupal/migrate_tools": "^5.0",
        "drupal/migrate_upgrade": "^3.2",
        "drupal/paragraphs": "^1.12",
        "drupal/pathauto": "^1.8",
        "drupal/pdf_reader": "1.x-dev",
        "drupal/superfish": "^1.4",
        "drupal/tablefield": "^2.1",
        "drush/drush": "^10.3"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": ""
            }
        },
        "installer-paths": {
            "core": [
                "type:drupal-core"
            ],
            "libraries/{$name}": [
                "type:drupal-library"
            ],
            "modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
}

Thanks Mark

2
  • Could you post your full composer.json file ? Commented Oct 13, 2020 at 17:24
  • @RadosławHalicki I've added that now. Orginally the document root was in a 'web' folder but I moved it back to the root, so I wonder if that's something to do with it. Commented Oct 13, 2020 at 17:52

1 Answer 1

2

There is simple solution for your issue. Add web-root folder. To be fair this is good practice to store vendor outside of web folder.

Here is example how you should do it (you can also change web to docroot or anything else you like):

    "extra": {
    "drupal-scaffold": {
        "locations": {
            "web-root": "./web"
        }
    },
    "installer-paths": {
        "web/core": [
            "type:drupal-core"
        ],
        "web/libraries/{$name}": [
            "type:drupal-library"
        ],
        "web/modules/contrib/{$name}": [
            "type:drupal-module"
        ],
        "web/profiles/contrib/{$name}": [
            "type:drupal-profile"
        ],
        "web/themes/contrib/{$name}": [
            "type:drupal-theme"
        ],
        "drush/Commands/contrib/{$name}": [
            "type:drupal-drush"
        ],
        "web/modules/custom/{$name}": [
            "type:drupal-custom-module"
        ],
        "web/themes/custom/{$name}": [
            "type:drupal-custom-theme"
        ]
    },

Probably you noticed that drush commands are outside of web folder. Same way you store build scripts, server hooks, patches etc.

Sign up to request clarification or add additional context in comments.

3 Comments

Yes this works (when I run it locally). I moved the files from the 'web' folder to the root because on our hosted server, it only works if the files are there. I will put a seperate question up tomorrow as I'm sure I must be missing something simple there.
This answer should probably note that these settings are what is used in recommended-project which is references in the Using Composer to Install Drupal and Manage Dependencies docs
To be fair I would recommand to change server settings to use web-root folder. This is how two best Drupal hostings work - Acquia and Pantheon. If not I will try to solve it without root folder also.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.