How do I use an older jQuery version? Drupal 8.5 requires jQuery 3, which has some site breaking features. I would rather like to use version 2.2.4. I have tried the libraries-override approach suggested in How do I use a jQuery version different from the default one used by core? After applying that answer, the theme.libraries.yml file content is the following one.

global-styling:
  css:
    theme: 
      css/main.css: {}

jquery-custom:
  remote: https://github.com/jquery/jquery
  version: "2.2.4"
  license:
    name: MIT
    url: https://github.com/jquery/jquery/blob/2.2.4/LICENSE.txt
    gpl-compatible: true

global-scripts:
  js:
    js/plugins.js: {}
    js/drupal-main.js: {}
    js/vendor/modernizr-3.3.1.min.js: {}
    js/jquery-2.2.4.min.js: { minified: true, weight: -20 }

  dependencies:
    - core/drupal
    - core/jquery
    - core/jquery.once


The theme.info.yml file content is the following one.

libraries:
  - theme/global-styling
  - theme/global-scripts
libraries-override:
  core/jquery: theme/jquery-custom


However, it gives me a reference error saying that jQuery is not defined. I have checked the path and there is no problem there. What am I missing here?

Is there any other way to downgrade from jQuery 3 to jQuery 2 in Drupal 8?

I also tried using the following code, but I still getting a reference error.

jquery-custom:
  remote: https://github.com/jquery/jquery.js
  version: "2.2.4"
  license:
    name: MIT
    url: https://github.com/jquery/jquery/blob/2.2.4/LICENSE.txt
    gpl-compatible: true
  js:
    js/jquery-2.2.4.min.js: { minified: true, weight: -20 }

global-scripts:
  js:
    js/plugins.js: {}
    js/drupal-main.js: {}
    js/vendor/modernizr-3.3.1.min.js: {}
I had the same issue with some older Google tags plugins that did not work with jquery 3.0.  You basically have to use the D8 library override methods in your theme to do this.

This actually goes into the theme info.yml file.  You need to have the other version of jquery defined in your library.yml file as well.  Here's some excerpts from my theme files.

my_theme.info.yml

libraries-override:
  #downgrade jquery / force jquery into header
  core/jquery: my_theme/jquery


The core/jquery was found by searching thru the core to find the jquery library definition.  

my_theme.libraries.yml

jquery:
  header: true
  remote: https://github.com/jquery/jquery
  version: "2.2.4"
  license:
    name: MIT
    url: https://github.com/jquery/jquery/blob/2.2.4/LICENSE.txt
    gpl-compatible: true
  js:
    js/jquery-2.2.4.min.js: { minified: true, weight: -20 }


Note: The header: true loads jquery in the header and not the footer.  Helps a bit with embedded jQuery code that complains that jquery does not exist.  I have a local copy of jquery in the js directory of my theme as well.

This technique can override any CSS or javascript included by any module or core.