Have been using the Webprofiler for a while and haven't noticed any issues until upgrading to Drupal 8.6.1 yesterday. Drupal Status now reports missing D3.js and Highlights.js libraries and references the README.md file for instructions when using composer. After following those instructions to add the libraries, Drupal Status is still reporting them as missing. (Cleared, caches, etc, etc).

Are these needed? If so what is Drupal Status looking for that it's not finding?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RustedBucket created an issue. See original summary.

xmacinfo’s picture

Those two libraries are optional. I never installed those two libraries in the past but I took the opportunity to try this out.

I successfully managed to install D3.js with Composer inside the libraries folder.

Unfortunately, using the same Composer recipe, Hightlight.js keeps being installed in the Vendor directory even if I configure Composer to install this library in the libraries folder.

lussoluca’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please provide the repositories and installer-paths sections of your composer.json?

Amstercad’s picture

While developing a site using Acquia's Lightning Distribution, I came to this thread via D3.js and Highlight.js errors within the Drupal Status Report.

After hacking around just a bit trying to use the Composer Require installation method as is advised, having initially failed, here's what worked for me:

Changed the instructional line 18 'modules/contrib/devel/webprofiler/README.md' with this difference (and followed that instruction myself):

from:

"libraries/{$name}": ["type:drupal-library"],

to:

"docroot/libraries/{$name}": ["type:drupal-library"],

The attached patch addresses the errors that I found. Composer Update delivered joy. NOTE that Lightning uses 'docroot' as the drupal-core machine_name while I have seen other Distributions use 'web' instead. YMMV

lpeabody’s picture

@xmacinfo I had to list the library and component types in the installer-types array in order to get both installing. I actually veered from the README and did not include the repository entries as asked, opting to depend on their presence in packagist instead. Works great for me.

cobenash’s picture

I use "https://github.com/drupal-composer/drupal-project" as the main Drupal folder structure. After I add these two package to repositories, it worked perfectly.

However, I don't need to add step2 because drupal-composer already added .

william.jieh’s picture

@Amstercad, thanks! Your solution works for me!

Kojo Unsui’s picture

In Drupal 8.7.8 with Lightning distribution with webprofiler 8.x-2.1, strictly following the steps in README.md worked as a charm. Composer/installers was the good point.

If you use Composer to manage dependencies, edit `/composer.json` as follows.

1\. Run `composer require --prefer-dist composer/installers` to ensure that you have the `composer/installers` package installed. This package facilitates the installation of packages into directories other than `/vendor` (e.g. `/libraries`) using Composer.

2\. Add the following to the "installer-paths" section of `composer.json`:

```
"libraries/{$name}": ["type:drupal-library"],
```

3\. Add the following to the "repositories" section of `composer.json`:

```
"d3": {
    "type": "package",
    "package": {
        "name": "d3/d3",
        "version": "v3.5.17",
        "type": "drupal-library",
        "dist": {
            "url": "https://github.com/d3/d3/archive/v3.5.17.zip",
            "type": "zip"
        }
    }
},
"highlightjs": {
    "type": "package",
    "package": {
        "name": "components/highlightjs",
        "version": "9.7.0",
        "type": "drupal-library",
        "dist": {
            "url": "https://github.com/components/highlightjs/archive/9.7.0.zip",
            "type": "zip"
        }
    }
}
```

4\. Run `composer require --prefer-dist d3/d3:3.5.* components/highlightjs:9.7.*` - you should find that new directories have been created
under `/libraries`

moshe weitzman’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Seems like there is nothing left to do here.

Rar9’s picture

Looking at the git the
d3/d3 latest is 5.14.2
components/highlights is 9.16.2

Is it recommended to update the zip to these versions??

I tried but D8.80 compains even with 9.7.0 highlight.js

karolus’s picture

@Rar9,
I would strongly suggest testing out how the visualizations render when updating D3 and related projects.

Due to significant changes between v.3 and v.5, it's quite possible that existing dataviz built for D3 v.3 will break.

At that point, it's pretty much either using D3 v.3 or refactoring the visualizations.

vrwired’s picture

This process verified to work on my side for D8.9.1:
https://www.drupal.org/project/devel/issues/2998760#comment-13345564
The libraries are indeed installed correctly via composer - note that you may need to adjust your path - i.e. web(or docroot)/libraries/

However, even with highlightjs correctly installed, status reports not found. For d3js, status report no longer not finding it. Seems may need something still then for highlightjs.