Updated: Comment #21

Problem/Motivation

Bootstrap_carousel module uses hook_requirements to check if bootstrap library exists. The problem is that library might not exist if bootstrap is served via CDN or from theme's subdir (common case if using Boostrap base theme).

This renders annoying false-positive warning in drupal status report The Bootstrap library could not be found.
error

Proposed resolution

Ignore bootstrap library requirement if bootstrap base theme is installed and active. This can be done with list_themes function.

Original report by JustinID

I have a really annoying issue with my subtheme of Bootstrap. I'm developing a subtheme based on Bootstrap and I'm using the second method (CDN). The subtheme works fine, but I keep getting this error in my status report.

Everything works fine, but I just want to get rid of this error in my report. I tried to add the bootstrap library in the libraries folder and also in the subtheme folder itself, but that doesn't change anything. I hope someone knows a simple solution, whether it's a stupid mistake of myself.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

markhalliwell’s picture

Project: Bootstrap » Bootstrap API
Version: 7.x-2.1 » 7.x-1.x-dev
Component: Miscellaneous » Documentation
Category: bug » support
Status: Active » Closed (works as designed)

Pretty sure this is because of the Bootstrap API module. Themes cannot provide status requirements, only modules.

Marking this as closed though. Since you're using the theme's CDN, you should probably just disable/remove the extra module.

madaerodog’s picture

Status: Closed (works as designed) » Active

In fact, it shows this without the Module activated, with the module activated I get another error on top of that :

Bootstrap - Library
You need to download the bootstrap js library from github. please read the documentation. Missing: bootstrap-affix, bootstrap-alert, bootstrap-button, bootstrap-carousel, bootstrap-dropdown, bootstrap-popover, bootstrap-scrollspy, bootstrap-tab, bootstrap-tooltip, bootstrap-typeahead, bootstrap-modal, bootstrap-collapse, bootstrap-transition

Seal-World’s picture

am having the same problem

Blackice2999’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

currently the theme dont use anything of this module so you dont need them for the theme.
If you want to use it for own development (using of modal dialogs or popover field support) than you are right here. in this case please explain exactly where your files lives.

markhalliwell’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

@madaerodog, then just install the module if you're not using it. This issue, as @Blackice2999 stated, isn't necessary with the Bootstrap base theme. It is for providing an API that ties the Bootstrap framework in manually.

JustinID’s picture

There is no Bootstap API module installed by the way. I tried so many things, but the error remains. Everything works perfectly, but it's just annoying that's all.

markhalliwell’s picture

@JustinID, I don't know what to tell you. The Bootstrap base theme does not implement any hook_requirements() (which is what is used to create entries on the status report page).

Blackice2999’s picture

Hi Justin,

are you 100% sure that you dont have sites/all/modules/bootstrap_api module installed ?

dadderley’s picture

I am having the same problem,
I disabled Bootstrap Carousel 7.x-1.0-rc1 and the problem went away,

JustinID’s picture

@Blackice2999

100% sure.

@dougzilla

I use Bootstrap Carousel too (7.x-1.0-rc5), but I can't disable it (probably because I have content with this type).

dadderley’s picture

@JustinID
That seems to be where the problem lies.

JustinID’s picture

So can we classify this as a bug in combination with Bootstrap Carousel?

Blackice2999’s picture

Project: Bootstrap API » Bootstrap Carousel
Version: 7.x-1.x-dev »
Assigned: JustinID » Unassigned
Status: Closed (works as designed) » Active

Hi,

not really. But it can be a Bootstrap Carousel issue so i change the project to it and the maintainer can react on this.

JustinID’s picture

Thanks!

ambientdrup’s picture

Having the same issue. Any updates on this?

-Trevor

cliff98109’s picture

I'm also seeing this, apparently after I installed bootstrap carousel.

hj-b’s picture

Same problem here. I'm using the Bootstrap Carousel module in combination with Nodeblock, works great only this error is a bit anoying. Trying to find the key of this problem.

hj-b’s picture

Found the key of this issue.

On line 41 of the bootstrap_carousel.install the function bootstrap_carousel_requirements() checks if the bootstrap library is installed.

if (($library = libraries_detect('bootstrap')) && !empty($library['installed'])) {
      $requirements['bootstrap_library'] = array(
        'title' => $t('Bootstrap library'),
        'value' => $t('Installed'),
        'severity' => REQUIREMENT_OK,
      );
    }
    else {
      $requirements['bootstrap_library'] = array(
        'title' => $t('Bootstrap library'),
        'value' => $t('Not installed'),
        'description' => $library['error message'],
        'severity' => REQUIREMENT_ERROR,
      );
    }

Because I use BootstrapCDN to serve the Bootstrap framework files I don't need this library so I commented this function to disable the check for the Bootstrap library. This solves the problem for me.

mazzen’s picture

Update JQuery to (at least) 1.8 with the "jQuery Update" module.

Best,

duntuk’s picture

@mazzen, jquery_update has nothing to do with this issue.

If you install the Bootstrap theme, by default it pulls all boostrap files from their CDN. Or it allows you to put the bootstrap libraries inside your custom theme...

What this module does is try to pull bootstrap from /libraries .

Not sure what would happen if one was to put bootstrap libraries in their theme and in /libraries, but probably wouldn't be good to include 2x.

Anyhow...

Eliminating the libraries check is the solution, as noted in #18.

As a work around, there should be an additional check in bootstrap_carousel.install, (maybe in the form of a checkbox) asking if user has the bootstrap libraries installed in their theme--if yes, error goes away, and module installs.

SiliconMind’s picture

Project: Bootstrap Carousel » bootstrap_carousel
Version: » 7.x-1.0-rc5
Component: Documentation » Code
Category: Support request » Bug report
Priority: Normal » Minor
Issue summary: View changes

Having the same issue but it seems that the issue was assigned to the wrong project. Bootstrap Carousel is a sandbox project whereas the issue is caused by the Bootstrap_Carousel module (note the underscore).

Bootstrap_carousel module uses hook_requirements to check if bootstrap library exists. The problem is that library might not exist if bootstrap is served via CDN or from theme's subdir (common case if using Boostrap base theme).

Proposed solution is to ignore bootstrap library requirement if bootstrap base theme is installed and active. This can be done with list_themes function.

markhalliwell’s picture

Priority: Minor » Major

Well that is certainly confusing. Glad that's sorted out.

What's also confusing is that the "requirement" implies that it pertains to the bootstrap theme rather than this specific module. I think that is partially why this message was so hard to track down (especially if you don't use this module, like me).

The message should be updated to reflect that the requirement is for this specific module as well (as any module should) as well as being downgraded from an "error" to a "warning".

I would also argue that this is a major issue. For certain services that check the status page of drupal installs, this can certainly cause hiccups in deployment when the "error" is actually not true or not true for this particular site (because they chose a different way to implement bootstrap). Regardless, this module makes many assumptions that it shouldn't (no disrespect to the maintainers, just pointing out a fact).

charlya’s picture

You must download bootstrap 2.3.2 at http://getbootstrap.com/2.3.2/ then put this files in sites/all/libraries/bootstrap.
Because the file say:
'file' => 'js/bootstrap.js',

In Bootstrap 3 this path does not exist.

mattyoung’s picture

I just ran into the same Status Report claiming "bootstrap" library not installed.

I had read somewhere else to name the directory twitter_bootscrap, I just renamed it to bootstrap and the problem went away.

This requirement error comes from bootstrap_carousel module

jayxdev’s picture

Hi,

I fixed this issue like this.
On the boostrap-business theme directory, you just have to copy the directory bootstrap/ in sites/all/libraries/ ,clear the cache and check on the dashbord administration, everything should be OK.

jayxdev’s picture

Status: Active » Fixed

Fixed

markhalliwell’s picture

Title: The Bootstrap library could not be found » Requirement status must be module specific: "The Bootstrap library could not be found"
Status: Fixed » Active

Yes, that will fix your local site issue. It doesn't change that this issue is about the confusion around where the message comes from. It must be fixed in this module's code.

Beezer75’s picture

Following this. I'm running the bootstrap theme and I want to use the bootstrap carousel module, the problem is that each wants to look for bootstrap in different places. The problem I run into is that loading it in the /libraries overrides the theme files and then my sub-theme stops working. I see the solution is to use the list_themes function, can anyone offer a little more specific detail on doing so?

BTW, #18 works, but I'd prefer a solution that didn't require hacking the module.

markhalliwell’s picture

DarkteK’s picture

#23 helped me :D

PROMES’s picture

I created a patch for the 'bootstrap_business' theme (using the 3.2.0 cdn). Since for each theme (and version) there will be another way to detect the presence of the bootstrap library, the code can easily extended.
The changed code is:

  $themes = list_themes();
  $libcheck = TRUE;
  if (isset($themes['bootstrap_business']) && $themes['bootstrap_business']->status) {
    $vars = variable_get('theme_bootstrap_business_settings', array());
    if (isset($vars['bootstrap_js_cdn']) && $vars['bootstrap_js_cdn'] == '3.2.0') {
      $libcheck = FALSE;
    }
  }

  // Check requirements during the runtime phase.
  if ($phase == 'runtime' && $libcheck) {
OlenaY’s picture

Hi to all

I installed this module in error. I do not need for it.
But. I can not to remove it. Because it "Required by: Drupal (Field type(s) in use - see Field list)".
There are all fields in the field list. I did not create any field with Bootstrap Carousel Module using.
Just installed it.

How I can to remove this module?

sami.etogo’s picture

#18 working for me, thanks!

gabrielmachadosantos’s picture

Version: 7.x-1.0-rc5 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
1.38 KB

Created a patch to search on default theme if it already has the bootstrap library. Tested with bootstrap and bootstrap_business themes and in order to load the bootstrap.js the theme must be set as default not just enabled. As soon as someone review/test I will release on 7.x-1.2.

// Search on default theme if it already has the bootstrap library.
$bootstrap_lib = FALSE;
$themes = list_themes();
$theme_default = variable_get('theme_default');
if (isset($themes[$theme_default]->info['settings'])) {
  foreach ($themes[$theme_default]->info['settings'] as $setting) {
    if (is_string($setting) && strpos($setting, 'bootstrap.js')) {
      $bootstrap_lib = TRUE;
      break;
    }
  }
}

$library = libraries_detect('bootstrap');
if (!empty($library['installed']) || $bootstrap_lib) {
bitspitosyflautas’s picture

thanks for patch in #34! i added extra case for bootstrap child themes:

...
if (isset($themes[$theme_default]->info['settings'])) {
    foreach ($themes[$theme_default]->info['settings'] as $setting) {
      if (is_string($setting) && strpos($setting, 'bootstrap.js')) {
        $bootstrap_lib = TRUE;
        break;
        }
    }
  } elseif (isset($themes[$theme_default]->base_theme)) {
    foreach ($themes[$themes[$theme_default]->base_theme]->info['settings'] as $setting) {
      if (is_string($setting) && strpos($setting, 'bootstrap.js')) {
        $bootstrap_lib = TRUE;
        break;
        }
    }
  }
...
leotorati’s picture

Assigned: Unassigned » leotorati
leotorati’s picture

Status: Needs review » Needs work
leotorati’s picture

According comment #35, if we use a subtheme from bootstrap we will have the issue, but the code in the same comment fix it. I created a patch adding that code.

leotorati’s picture

Status: Needs work » Needs review
leotorati’s picture

Assigned: leotorati » Unassigned
atoledo@ciandt.com’s picture

Status: Needs review » Needs work

The current verification is checking if the base_theme has a settings with bootstrap.js, but it will not load it.

We should change the approach to:

  • If the current theme or any of its base themes is based on bootstrap, presume the requirement is already met.
  • If not, check if the library is loaded locally
leotorati’s picture

Status: Needs work » Needs review
FileSize
2.32 KB

I agree with approach suggested by atoledo in comment #41, so, I changed the code for hook_requirements to reflect that.

nimzie’s picture

subscribing - having this issue as well. Is this patch working / safe / recommended?

kirand’s picture

#23 fixed the issue.

emartoni’s picture

FileSize
119 KB
127.54 KB
118.34 KB

#42 works fine to mee!

Thanks @leotorati.

Attached 3 images:
1) No bootstrap theme installed and report shows error.
2) Bootstrap theme installed and enabled.
3) Bootstrap theme with no error message on report.

emartoni’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +#ciandt-contrib