Composer因私有Gitlab存储库而失败

时间:2017-11-08 18:37:15

标签: php wordpress composer-php gitlab

我有一个新项目,我想要一个私人Gitlab存储库。两个存储库都属于我,所以我可以改变我想要的任何东西。

项目的composer.json如下:

{
    "name": "thisismyproject",
    "type": "project",
    "minimum-stability": "dev",
    "authors": [
        {
            "name": "me",
            "email": "me@me.me"
        }
    ],
    "repositories": [
        {
            "type": "vcs",
            "url": "https://gitlab.com/me/my-wordpress-plugin.git"
        }
    ],
    "require": {
        "composer/installers": "^1.0@dev",
        "me/my-wordpress-plugin": "dev-master"
    },
    "extra": {
        "installer-paths": {
            "wp-content/plugins/{$name}": [
                "type:wordpress-plugin"
            ]
        }
    },
    "config": {
        "gitlab-token" : {
            "gitlab.com": "thisismysupersecrettoken"
        }
    }
}

wordpress插件存储库的composer.json如下所示:

{
    "name": "WordPress Plugin",
    "description": "lorem",
    "type": "wordpress-plugin",
    "authors": [
        {
            "name": "me",
            "email": "me@me.de"
        }
    ],
    "require": {},
    "autoload": {
        "psr-4": {
            "SomeNamespace\\": "."
        }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.0-dev"
        }
    }
}

composer update -vvv的输出如下:

Downloading https://gitlab.com/api/v4/projects/me%2Fmy-wordpress-plugin
Downloading https://gitlab.com/api/v4/projects/me%2Fmy-wordpress-plugin/repository/branches?per_page=100
Downloading https://gitlab.com/api/v4/projects/me%2Fmy-wordpress-plugin/repository/files/composer%2Ejson/raw?ref=14
3c1818bfc96dcaa4ee5c26cc0bd379c395491c
Downloading https://gitlab.com/api/v4/projects/me%2Fmy-wordpress-plugin/repository/tags?per_page=100
Reading composer.json of WordPress Plugin (v1.0.0)
Downloading https://gitlab.com/api/v4/projects/me%2Fmy-wordpress-plugin/repository/files/composer%2Ejson/raw?ref=14
3c1818bfc96dcaa4ee5c26cc0bd379c395491c
Writing /home/vagrant/.cache/composer/repo/gitlab.com/me/my-wordpress-plugin/143c1818bfc96dcaa4ee5c26cc0bd379c39549
1c into cache
Importing tag v1.0.0 (1.0.0.0)
Reading composer.json of WordPress Plugin (master)
Importing branch master (dev-master)
Downloading https://packagist.org/packages.json
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package me/my-wordpress-plugin could not be found in any version, there may be a typo in the pa
ckage 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  for more details.

Read  for further common problems.

有什么建议吗?

感谢。

1 个答案:

答案 0 :(得分:3)

您收到错误是因为您的包裹名称不同。

要解决此问题,您需要更新WordPress插件的composer.json中的名称。

{
    "name": "me/my-wordpress-plugin",
    "description": "WordPress Plugin",
    "type": "wordpress-plugin",
    "authors": [
        {
            "name": "me",
            "email": "me@me.de"
        }
    ],
    "require": {},
    "autoload": {
        "psr-4": {
            "SomeNamespace\\": "."
        }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.0-dev"
        }
    }
}

该名称应与您的主key的{​​{1}}中的require相匹配:

composer.json