npm-assets not copied to docroot/libraries during composer install

Created on 24 February 2023, over 1 year ago
Updated 27 March 2024, 8 months ago

Problem/Motivation

We have been using this module for some time, and we also have the following line in the "require" section of our composer.json:

"npm-asset/jquery-validation": "^1.19.5",

As recently as 4.6.0 of this module, that line resulted in the jquery-validation package being copied to docroot/libraries during composer install. But when we upgraded to the latest version of this module, 4.10.0, the jquery-validation package was no longer copied to docroot/libraries. This caused javascript errors on our site as the package did not make it into the aggregated javascript files.

Steps to reproduce

I suspect this problem is unique to our site because we have that particular line in our composer.json. But here is a link to a version of the composer.json that has this problem:

https://github.com/usdoj/foia-api/blob/207978184c0d27bf7f7edcf4021872894...

With the above composer.json, the jquery-validation library does not get copied to docroot/libraries. So we had to pin this module to 4.6.0. Here is the pinned version of composer.json in which the problem is fixed:

https://github.com/usdoj/foia-api/blob/fef3b84a543f26b1e2979466c17e487c0...

With this new version of composer.json, the jquery-validation library does get copied to docroot/libraries.

Proposed resolution

This may be a support request, if there is something specific in our composer.json that is causing this. However I wanted to post this in case there might have been an unintended breaking change after 4.6.0. If that is the case, then my proposed solution would be to release 4.11.0 with a revert of whatever that breaking change was.

Remaining tasks

Feedback on whether this is a breaking change or a bug in our site-specific composer.json.

πŸ’¬ Support request
Status

Fixed

Version

4.10

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States brockfanning

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

Comments & Activities

  • Issue created by @brockfanning
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    First of all...thank you for the clear and detailed report, and for posting your composer.json. Super helpful. πŸ™

    I think I see the problem -- you're not requiring oomphinc/composer-installers-extender, which is the thing that enables support for npm-asset and bower-asset packages.

    This makes sense; that plugin used to be a dependency of Lightning Media, so you would have had no reason to make it a direct dependency. Unfortunately, circumstances forced me to remove it in πŸ“Œ Add an update hook to download required JavaScript libraries Fixed , even though it was a breaking change. I tried to put an update path in there to at least cover the libraries that Lightning Media's submodules require in order to work properly, and documented this in the release notes for 8.x-4.9: https://www.drupal.org/project/lightning_media/releases/8.x-4.9 β†’

    I assume you're using Composer 2, since I see you have the allow-plugins configuration set up properly. I think these commands should -- hopefully! -- get you back on your feet:

    composer require --no-update oomphinc/composer-installers-extender:^2
    composer update oomphinc/composer-installers-extender npm-asset/jquery-validation
    

    Let me know if that helps!

  • Status changed to Fixed 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States brockfanning

    I finally got around to fixing this, and the composer require --no-update oomphinc/composer-installers-extender:^2 command worked perfectly. Thank you!

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

  • πŸ‡¨πŸ‡΄Colombia IngJheyner

    Sirvio muchas gracias.

Production build 0.71.5 2024