Installing Library Using Drupal & Composer

PROBLEM
The instructions on drupal.org on how to install a library using composer suck. Or maybe I’m just doing it wrong? I don’t know. But it happened again. I need another library from some outside source.

I thought I just needed to modify my composer.json file and run composer install and it was good but I forgot the other step.

SOLUTION
You also need to run composer require and whatever you named your library.

Here’s the code from my composer.json:

		{
			"type": "package",
			"package": {
				"name": "addon/youtube",
				"version": "2.1.18",
				"type": "drupal-library",
				"dist": {
					"url": "https://download.ckeditor.com/youtube/releases/youtube_2.1.18.zip",
					"type": "zip"
				}
			}
		},

Save the file. Then run:

$ composer require addon/youtube

That should do it. Maybe run another $ composer install so everything is good.

Leave a Reply

Your email address will not be published. Required fields are marked *