How to place a library in DRUPAL_ROOT/libraries? In Drupal 8, when I declare a library in a .libraries.yml file, it seems the library files have to be located INSIDE the module or the theme folder with the .libraries.yml file.

For instance, if a MYMODULE module contains this .libraries.yml file:

form-alter-css:
  version: 1.x
  css:
    theme:
      css/form-alter.css: {}


The file css/form-alter.css has to live at DRUPAL_ROOT/modules/MYMODULE/css/form-alter.css.

Instead, for shared libraries, I'd like to place the files in DRUPAL_ROOT/libraries, like we did in Drupal 7. But how?

I have tried entering an absolute path in the .libraries.yml file (e.g. /libraries/css/form-alter.css) but it doesn't work. Any ideas?
In drupal 7 the shared libraries were provided by a contrib module. Because a lot of modules had this as a dependency, it was very common:

Libraries API

I don't know, if this will be used this often in drupal 8, you can follow the development here:

https://www.drupal.org/node/1704734

So at the moment you are stuck with the libraries in *.libraries.yml, when you don't want to use the dev version of the Libraries API.

The libraries in *.libraries.yml were not designed for libraries in a shared directory. But they have one very useful feature, you can borrow a library from another module. There are a lot of useful packages already in core modules, like jquery ui elements. If you define a library in one of your modules, they also become available for all other modules. But the files will remain local to that module, which defines the library.