The colorbox is an interesting module that works with external libraries in Drupal 9, when you use this module, you need to download and put the libraries under directory libraries in Drupal 9, but what happened when you work just with composer.json, you can’t add or deploy these libraries so you need to use only composer and for this, you need to continue reading
https://www.drupal.org/project/colorbox/issues/2869067#comment-14583950
Modify your composer.json and add into “repositories” section
"assets-packagist": {
"type": "composer",
"url": "https://asset-packagist.org"
},
after that remember to require oomphinc/composer-installers-extender
composer require oomphinc/composer-installers-extender
Add the following to your project composer.json in the "extra" section:
"installer-types": [
"bower-asset",
"npm-asset"
],
"installer-paths": {
"docroot/libraries/{$name}": [
"type:bower-asset",
"type:npm-asset"
]
}
and finally require:
composer require bower-asset/colorbox
composer require npm-asset/dompurify
Enjoy a lot
Tags