Getting libraries to install

Created on 10 May 2023, almost 2 years ago

How to get libraries api to recognize libraries ?? How to get this to work ??

I tried putting the libraries in the library-definition folder as outline in => https://www.drupal.org/docs/contributed-modules/libraries-api-8x/install... β†’

There is sparse documentation on how to get a library to install/load for a contributed module - and the module installs (and uninstalls) but I then get this

Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException: The library definition for the library 'caret.js' could not be found. in Drupal\libraries\ExternalLibrary\Definition\ChainDefinitionDiscovery->getDefinition() (line 56 of modules/libraries/src/ExternalLibrary/Definition/ChainDefinitionDiscovery.php).
Drupal\libraries\ExternalLibrary\LibraryManager->load('caret.js') (Line: 293)
atjs_requirements('runtime') (Line: 52)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler::Drupal\hook_event_dispatcher\{closure}(Object, 'atjs') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('requirements', Object) (Line: 67)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAllWith('requirements', Object) (Line: 59)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAll('requirements', Array) (Line: 109)
Drupal\system\SystemManager->listRequirements() (Line: 49)
Drupal\system\Controller\SystemInfoController->status()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 52)
Drupal\crawler_rate_limit\CrawlerRateLimitMiddleware->handle(Object, 1, 1) (Line: 57)
Drupal\advban\AdvbanMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

The install file has the following code

$libraries = \Drupal::service('library.libraries_directory_file_finder')->find('at.js');
$libraries2 = \Drupal::service('library.libraries_directory_file_finder')->find('caret.js');
$installed_caretjs = \Drupal::service('libraries.manager')->load('caret.js');
$installed_atjs = \Drupal::service('libraries.manager')->load('at.js');

along with error code but no error is thrown

πŸ’¬ Support request
Status

Active

Version

4.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States bobburns

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024