when I try to install the new version 1.1 with composer i get:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - drupal/ace_editor 1.1.0 requires ajaxorg/ace-builds ~1.4.0 -> no matching package found.
    - drupal/ace_editor 1.x-dev requires ajaxorg/ace-builds ~1.4.0 -> no matching package found.
    - Installation request for drupal/ace_editor ^1.1 -> satisfiable by drupal/ace_editor[1.x-dev, 1.1.0].

while with version 1.0 there are no worries ...

CommentFileSizeAuthor
#23 status_report.jpg15.4 KBinterdruper
#9 3022330-9.patch1.18 KBRajab Natshah
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

steveoriol created an issue. See original summary.

mmjvb’s picture

Confirmed.
The definition of that package is in the composer.json of this module:

{
      "type": "package",
      "package": {
        "name": "ajaxorg/ace-builds",
        "version": "1.4",
        "type": "drupal-library",
        "dist": {
          "url": "https://github.com/ajaxorg/ace-builds/archive/v1.4.0.zip",
          "type": "zip"
        }
      }
    }

Adding the definition to your project will allow it to install:

docker@cli:/var/www$ composer require drupal/ace_editor
    
Using version ^1.1 for drupal/ace_editor
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
    1/2:	https://ftp.drupal.org/files/projects/ace_editor-8.x-1.1.zip
    2/2:	https://github.com/ajaxorg/ace-builds/archive/v1.4.0.zip
    Finished: success: 2, skipped: 0, failure: 0, total: 2
Package operations: 2 installs, 0 updates, 0 removals
  - Installing ajaxorg/ace-builds (1.4): Loading from cache
  - Installing drupal/ace_editor (1.1.0): Loading from cache
Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles
docker@cli:/var/www$

See https://getcomposer.org/doc/faqs/why-can%27t-composer-load-repositories-...

steveoriol’s picture

OK, I comfirm that after add the definition of the "ace-builds" package is in the composer.json of the drupal project, "composer update" works well. Thank you.

...
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
          "type": "package",
          "package": {
            "name": "ajaxorg/ace-builds",
            "version": "1.4",
            "type": "drupal-library",
            "dist": {
              "url": "https://github.com/ajaxorg/ace-builds/archive/v1.4.0.zip",
              "type": "zip"
            }
          }
        }

    ],
...

composer update

Gathering patches for root package.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 1 update, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing ajaxorg/ace-builds (1.4): Loading from cache
  - Updating drupal/ace_editor (1.0.0 => 1.1.0): Loading from cache
Writing lock file
Generating optimized autoload files
interdruper’s picture

Status: Active » Closed (works as designed)

Composer cannot load repositories recursively... you need to update the composer.json of your project, adding the ace repository (see #3) or using the merge-plugin under the 'extra' section of your project's composer.json:

        "merge-plugin": {
            "require": [
                "core/composer.json",
                "modules/contrib/ace_editor/composer.json"
            ],
            "recurse": true,
            "replace": false,
            "merge-extra": false
        },
therealbene’s picture

I think this extra step of add Composer repository or merge-plugin should be added to the documentation/readme to help new users.

mmjvb’s picture

Status: Closed (works as designed) » Needs work

Disagree with works as designed. The readme doesn't specify the dependency. Nor does it inform you about the need to add it to the composer.json of your project. There are several options depending on how your project is set up. Indeed, this should be properly documented.
Consider this a bug because the currently documented instructions lead to failure!

malcolm_p’s picture

I agree that this is problematic as it also breaks the update process. I can't add the merge-plugin when the currently installed version of ace_editor doesn't have this composer.json.

Furthermore, I was using "bower-asset/ace-builds" from:

"repositories": {
"asset-packagist": {
"type": "composer",
"url": "https://asset-packagist.org"
}
}

which is a very convenient way to use all sorts of JS asset dependencies with Composer.

Rajab Natshah’s picture

With the following command, we could add the https://asset-packagist.org composer repositories to any composer project

composer config repositories.assets composer https://asset-packagist.org
Rajab Natshah’s picture

FileSize
1.18 KB

Attached a patch which updates the ACE composer to a better way

Rajab Natshah’s picture

Status: Needs work » Needs review
SpiesInOrbit’s picture

I had to add a label for it to work. It threw a bad json error. Don't know if the "ace-builds" makes a difference.

  "ace-builds": {
    "type": "package",
    "package": {...
Mohammed J. Razem’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Hi.

I really recommend you standardize the composer.json repositories and use "npm-asset/ace-builds" instead of your custom repository.

Patch #9 fixes this.

ydahi’s picture

rtbc +1 for patch in #9. definitely the preferred method. Please commit.

interdruper’s picture

Status: Reviewed & tested by the community » Needs review

I have temporarily committed the patch #9 to the 8.x-1.x branch for letting people check it under the usual Drupal packaging, because I have not been able to get it working.

In a clean 8.6.17 installation:

composer require 'drupal/ace_editor:1.x-dev'

fails unless the asset-packagist repo is added in the composer.json of the Drupal project:

    "repositories": {
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "assets": {
            "type": "composer",
            "url": "https://asset-packagist.org"
         }
    }

So as indicated in comment #3, you need to modify the project's composer.json prior to install the module. But with the comment #3 method, no patch like #9 is required to 8.x-1.1.

But the main problem with the patch #9 in my case is that composer update does not copy the Ace library to the libraries/ace folder... something is not going well with "composer/installers" and/or "drupal/drupal-library-installer-plugin", but even with composer -vvv option I could not found any hint of why it is failing...

malcolm_p’s picture

Regarding #14 the library location would need to be managed from the project composer.json file as well like the following:

"extra" : {
  "installer-types": [
    "npm-asset"
  ],
  "installer-paths": {
    "docroot/libraries/ace": [
      "npm-asset/ace-builds"
    ]
  }
}

This should definitely be documented in the readme installation steps though.

elgandoz’s picture

Maybe I'm getting something wrong, but using "drupal-composer/drupal-project" the general libraries path is already defined:

 "installer-paths": {
            "public_html/core": [
                "type:drupal-core"
            ],
            "public_html/libraries/{$name}": [
                "type:drupal-library"
            ],
            [...]
}

Nevertheless, using "public_html/libraries/ace": ["npm-asset/ace-builds"] still install the library in vendor/npm-asset/ instead of public_html/libraries/.
I added the asset repo under "repositories".

Rajab Natshah’s picture

They should be in the Root composer.json, it did not work when we have it only the module
as the composer dose not merge the extra values in the root composer and the module composer

my current fix its to have that too in the root composer.

mmjvb’s picture

In addition the specific path for ace needs to be in front of the generic paths.

mrP’s picture

+1 RTBC

I would suggest an update to the README installation section that includes the step of adding the packagist repository as noted in #8

composer config repositories.assets composer https://asset-packagist.org
composer require 'drupal/ace_editor:1.x-dev'

interdruper’s picture

Status: Needs review » Fixed

Committed to dev. Added oomphinc/composer-installers-extender package dependency to follow https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#third-party-libraries .

README updated with installation instructions. Thanks everybody.

mmjvb’s picture

Status: Fixed » Needs work

Still missing the most important part: renaming the library from ace-builds to ace as mentioned in #15. As mentioned in #18 that needs to be in front of generic type paths.

interdruper’s picture

FileSize
15.4 KB

mmjvb, this is not required, since fortunately the module searches for the library recursively inside the /libraries path, and the library is recognized regardless of the name of the folder in which it was installed.

Anyway, in the link provided in the README (https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#third-party-libraries, section 4) explains how to set the folder to an specific folder name, if the user wants to.

Status Report

interdruper’s picture

Status: Needs work » Needs review
mmjvb’s picture

Glad to hear that it is not a requirement. That requirement should be removed from the project page. Currently that contradicts with the information provided in the readme.

interdruper’s picture

Status: Needs review » Fixed

Project page updated. Thanks for pointing it out.

Status: Fixed » Closed (fixed)

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

Tabestan’s picture

This is still broken. The readme needs to be updated. The module cannot be installed with the current instructions.

ahillio’s picture

It's not still broken (though I also thought it was at first)... this patch is only part of the solution, the other part of the solution is to edit your composer.json file to make it work with asset-packagist. This is explained in the README.txt which the project page mentions. For convenience I'm pasting those here...

Edit composer.json like so:

To the "extra" section: add the following:

          "installer-types": [
              "npm-asset"
          ],
          "installer-paths": {
              "libraries/{$name}": [
                  "type:drupal-library",
                  "type:npm-asset"
              ]
          }

To the "repositories" section: add the following:

          "assets": {
              "type": "composer",
              "url": "https://asset-packagist.org"
          }
mmjvb’s picture

See #8 for adding asset as repository.

Unless you want to get into a fight about proper json syntx, the command in #8 deals with it for all situations. When manually editing the repositories section you need to make sure it is valid json. Adding the lines as suggested in #29 is NOT valid for all json out there.

ressa’s picture

I also couldn't install the module, neither in Drupal 9, nor in Drupal 10, so I have created #3353188: Update README.md Composer steps, and format to Markdown.