Composer Module installation during development without repository (Oxid 6.2)

For the installation of a module during development in Oxid 6.2 I followed the best practices described here: https://docs.oxid-esales.com/developer/en/6.2/development/modules_components_themes/module/tutorials/module_setup.html

As the module is in development, using a repository is not a viable solution for every single change.

Thus, I manually copied the module to the Oxid modules’ folder: <shop_directory>/source/modules/<my-vendor>/<my-module>

Then from the Console, being inside the <shop_directory>, I ran the followings:

# <my-module-path> = /source/modules/<my-vendor>/<my-module>
# <my-package-name> = the name value from /source/modules/<my-vendor>/<my-module>/composer.json
vendor/bin/oe-console oe:module:install-configuration <my-module-path>
# Output: Module configuration has been installed.
composer config repositories.<my-package-name> path <my-module-path>
# <shop_directory>/composer.json gets updated as expected with the new repository
composer require <my-package-name>:*
# Output:
/*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package <my-package-name> could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.
*/

I went through the list of potential causes, however none of them seems to be the case.

As a workaround I had to manually add the Composer namespaces for autoloading inside the <shop_directory>/composer.json file:

    "autoload": {
        "psr-4": {
            "MyVendor\\CustomModule1\\": "./source/modules/myvendor/custommodule1",
            "MyVendor\\CustomModule2\\": "./source/modules/myvendor/custommodule2"
        }
    }

Isn’t it possible to avoid this workaround for a Module installation during development without having an actual repository?

We are talking about composer repositories and not about versioning repositories, right?

The whole concept of package/dependency management is built on top of repositories.
Basically: you cant install a package if there is no source (repository) for this package.

Also composer repository is not required to be a git repository, they both work independently and you can use any directory in your filesystem as repository for composer.

According your particular case:
you used the absolute path instead of relative path for your repository:
wrong: /source/modules/<my-vendor>/<my-module>
correct: source/modules/<my-vendor>/<my-module>

Thanks for your reply!

I was referring to not having an actual git/versioning repository.
That’s the same as I thought that any directory can be a repository for Composer.

The absolute path in my initial post was just a typo in the post, on my actual machine I tried with both the correct relative path, and full absolute path.

Unfortunately I get the same error message and I can’t understand what’s causing it.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.