I have run into an unexpected problem with a fresh install of drupal 8.

Initial setup

$ git clone https://github.com/drupal-composer/drupal-project dp
$ cd dp
$ composer install

This works fine, installs everything. I now repeat the same thing, and use the composer.lock file from the above.

$ git clone https://github.com/drupal-composer/drupal-project dp2
$ cp dp/composer.lock dp2/
$ cd dp2
$ composer install

This time, however, the web/folder just has folders in it, no files. In fact, a diff between the two folders shows a number of missing files including in sites and sites/default.

I thought the composer.lock file was used to simply lock the versions of the modules down.

What am I missing here?

  • The composer.lock file keeps track of installed versions of packages. (Since composer.lock indicated they are there, they are no longer downloaded.) If you need to lock versions down, you can do that in composer.json instead. See Versions. – Neograph734 Sep 2 '17 at 10:20
  • according to stackoverflow.com/a/39502171/1703195 and various other resources online, that is not how composer.lock works. Besides, it had put most of files and folders into place. It was only a handful of files that we missing. – drone.ah Sep 2 '17 at 10:46
  • Oh, thanks... Then I always had it wrong :s (but I never work with collegues). – Neograph734 Sep 2 '17 at 10:51

After some investigation, I found the culprit. The composer project uses drupal scaffold to place these files. However, this does not seem to be getting executed when the .lock file is already in place when you do the composer install

To resolve this, it was as simple as running the following command

$ composer drupal-scaffold
  • For me it was composer drupal:scaffold – bloke_zero Nov 26 '18 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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