1. Add repositories to composer.json

    "repositories": [
        {
          "type": "composer",
          "url": "https://packages.drupal.org/8"
        },
        {
           "type": "composer",
           "url": "https://asset-packagist.org"
         }
    ],
  2. Add bower-asset & npm-asset to installer-types

    "installer-types": [
        "bower-asset",
        "npm-asset",
        "drupal-drush",
        "drupal-theme",
        "drupal-profile",
        "drupal-module",
        "drupal-core"
    ],
  3. Update installer-paths for libraries

    "installer-paths": {
        "web/core": ["type:drupal-core"],
        "web/libraries/{$name}": [
            "type:drupal-library",
            "type:bower-asset",
            "type:npm-asset"
        ],
        "web/modules/contrib/{$name}": ["type:drupal-module"],
        "web/profiles/contrib/{$name}": ["type:drupal-profile"],
        "web/themes/contrib/{$name}": ["type:drupal-theme"],
        "drush/Commands/contrib/{$name}": ["type:drupal-drush"],
        "web/modules/custom/{$name}": ["type:drupal-custom-module"],
        "web/profiles/custom/{$name}": ["type:drupal-custom-profile"],
        "web/themes/custom/{$name}": ["type:drupal-custom-theme"],
        "web/private/scripts/quicksilver/{$name}/": ["type:quicksilver-script"]
    },
  4. Now we will be able to install npm and bower packages using composer and those packages will download into web/libraries. Run the following composer command to try it.

    composer require npm-asset/bootstrap