No such file bootstrap/js/bootstrap.js

Created on 7 September 2024, 11 days ago
Updated 13 September 2024, 5 days ago

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

🐛 Bug report
Status

Fixed

Version

5.0

Component

Code

Created by

🇩🇪Germany marc.bau

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

Comments & Activities

  • Issue created by @marc.bau
  • 🇧🇪Belgium flyke

    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.min.js: { type: external, minified: true }
  • 🇩🇪Germany marc.bau

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

  • 🇧🇪Belgium flyke

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

  • 🇩🇪Germany marc.bau

    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.

  • 🇧🇪Belgium flyke

    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.

  • 🇵🇪Peru hatuhay Lima

    If the error is showing on the sass subtheme version, then themes/contrib/bootstrap/js/bootstrap.js is copied from npm loaded bootstrap folder using gulp

    • hatuhay committed b1dac7a3 on 5.0.x
      Issue #3472811 by hatuhay:  No such file bootstrap/js/bootstrap.js
      
  • Status changed to Fixed 5 days ago
Production build 0.71.5 2024