问题
I have a TYPO3 extension hosted on bitbucket. I would like to get this extension with composer. As I understood, there must be a composer.json in my extension root and there must be some entries in my composer.json which i run composer install
composer.json of my extension
{
"name": "vendor/extkey",
"type": "typo3-cms-extension",
"description": "Extension for bla bla bla",
"keywords": [],
"homepage": "http://www.vendor.com",
"authors": [
{
"name": "blah",
"email": "dev@vendor.com",
"role": "Developer"
}
],
"version": "2016",
"require": {
"composer/installers": "~1.0",
"typo3/cms-core": "^7.6.0"
}
}
composer.json which i run composer update:
{
"repositories": [
{
"type": "composer",
"url": "http://composer.typo3.org/"
},
{
"type": "git",
"url": "https://user@bitbucket.org/path/extension.git"
}
],
"name": "blah",
"require": {
"typo3/cms": "7.6.2",
"bk2k/bootstrap-package" : "dev-master",
"path/extension": "2016"
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "web"
},
"installer-paths": {
"typo3conf/ext/{$name}": ["vendor/package"]
}
}
}
I get always an error: The requested package path/extension could not be found in any version, there may be a typo in the package name.
Does somebody has a working example?
回答1:
The requested package
<insert-package-key-here>could not be found in any version, there may be a typo in the package name.
This message means that the version that you're requesting Composer to install does not exist in the registered repository. Now, when requiring a package from a Git repository, Composer will use the tags and branches from that repository for its versioning information.
As you have required your extension as "vendor/extKey": "2016", Composer will look for a tag named 2016 in your repository.
You stated in comments that you have a branch named 2016 instead. When requiring a branch, you will need to use dev-<branch> as version specifier in your composer.json:
"require": {
"vendor/extKey": "dev-2016"
}
Alternatively, create a tag in your repository and use that as version in your composer.json.
See also the Composer manual on this (emphasis mine):
Tags
For every tag that looks like a version, a package version of that tag will be created. It should match 'X.Y.Z' or 'vX.Y.Z', with an optional suffix of -patch (-p), -alpha (-a), -beta (-b) or -RC. The suffix can also be followed by a number.
Branches
For every branch, a package development version will be created. If the branch name looks like a version, the version will be
{branchname}-dev. For example, the branch 2.0 will get the 2.0.x-dev version (the .x is added for technical reasons, to make sure it is recognized as a branch). The 2.0.x branch would also be valid and be turned into 2.0.x-dev as well. If the branch does not look like a version, it will bedev-{branchname}.masterresults in adev-masterversion.
来源:https://stackoverflow.com/questions/34769510/composer-install-fails-trying-to-get-own-typo3-extension-hosted-on-bitbucket