Problem/Motivation

I get this error when the theme is loaded after a cache clear. The file does not exist for sure.

Warning: file_get_contents(themes/contrib/bootstrap/js/bootstrap.js): Failed to open stream: No such file or directory in _locale_parse_js_file() (line 1097 of core\modules\locale\locale.module)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

marc.bau created an issue. See original summary.

flyke’s picture

Temporary fix, using CDN instead of including the necessary bootstrap file in the theme itself:

edit bootstrap.libraries.yml and add a new 'bootstrap-js' library which for now uses a CDN url for the necessary js file.
Then edit the global-styling library and add bootstrap/bootstrap-js as a dependency:

global-styling:
  version: VERSION
  css:
    component:
      css/components/variables.css: { weight: -20 }
      css/components/affix.css: {}
      css/components/book.css: {}
      css/components/contextual.css: {}
      # @see https://www.drupal.org/node/2389735
      css/components/feed-icon.css: {}
      css/components/field.css: {}
      css/components/header.css: {}
      css/components/help.css: {}
      css/components/icons.css: {}
      css/components/image-button.css: {}
      css/components/item-list.css: {}
      css/components/list-group.css: {}
      css/components/media.css: {}
      css/components/page.css: {}
      css/components/search-form.css: {}
      css/components/shortcut.css: {}
      css/components/sidebar.css: {}
      css/components/site-footer.css: {}
      css/components/skip-link.css: {}
      css/components/table.css: {}
      css/components/tabledrag.css: {}
      css/components/tableselect.css: {}
      css/components/tablesort-indicator.css: {}
      css/components/ui.widget.css: {}
      css/components/tabs.css: {}
      css/components/toolbar.css: {}
      css/components/user.css: { weight: -10 }
      # @see https://www.drupal.org/node/2389735
      css/components/vertical-tabs.css: {}
      css/components/views.css: {}
      css/components/webform.css: {}
      css/components/ui-dialog.css: {}
      css/components/progress.css: { weight: -10 }
    theme:
      css/print.css: { media: print }
  dependencies:
    - core/drupal
    - bootstrap/bootstrap-js

bootstrap-js:
  version: '5.3.3'
  js:
    https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js: { type: external, minified: true }
marc.bau’s picture

Well, my websites should not depend on external servers. All files must come from my machine.

flyke’s picture

I agree, its up to the maintainers of this module to include the necessary files.
This is just a workaround.

marc.bau’s picture

themes/contrib/bootstrap/js/bootstrap.js is a file that exist in B3, but dot not in B5. But the references to the file still exists in code. That is the reason why this error bubbles up. Only the reference need to be removed I think.

flyke’s picture

I think the file is needed, I think without it JS functions like closing a status message by clicking on the X will not work, or info popups (popper.js stuff) will also not work without it I think. But feel free to test by removing it from the libraries.yml file, clear your cache, and try to close any status message. Like when clearing caches from the frontend, try to close the all caches have been cleared message.

hatuhay’s picture

The correct js file to be loaded is base.js

  • hatuhay committed b1dac7a3 on 5.0.x
    Issue #3472811 by hatuhay:  No such file bootstrap/js/bootstrap.js
    
hatuhay’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.