首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Composer似乎指的是源URL,而不是dist URL

Composer似乎指的是源URL,而不是dist URL
EN

Stack Overflow用户
提问于 2017-04-18 14:22:02
回答 1查看 1.9K关注 0票数 5

我已经设置了一个带有基本HTTP身份验证的server。

配置文件如下所示:

代码语言:javascript
复制
{
    "name": "MySatisServer",
    "homepage": "https:\/\/satis.example.co.uk",
    "repositories": [
        {
            "type": "git",
            "url": "git@github.com:Org\/Repo1.git"
        },
        {
            "type": "git",
            "url": "git@github.com:Org\/Repo2.git"
        },
        {
            "type": "git",
            "url": "git@github.com:Org\/Repo3.git"
        },
        {
            "type": "git",
            "url": "git@github.com:Org\/Repo4.git"
        }
    ],
    "require-all": true,
    "require-dependencies": true,
    "require-dev-dependencies": true,
    "archive": {
        "directory": "dist",
        "format": "zip",
        "prefix-url": "https://satis.example.co.uk"
    }
}

我已经运行了讽刺构建,它用看起来正确的packages.json文件创建了我的dist目录。

我可以在浏览器中访问https://satis.example.co.uk,下载任何版本的存储库,这些存储库都是我想要的ZIP版本,而且工作正常。

当我试图通过composer使用回购时,问题就出现了。

我的composer.json文件如下所示:

代码语言:javascript
复制
{
    "name": "some/project",
    "description": "",
    "license": "proprietary",
    "authors": [],
    "require": {
        "org/repo-4": "^1.0"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://satis.example.co.uk"
        }
    ]
}

由于Server支持基本HTTP身份验证,所以我还有一个auth.json文件,如下所示:

代码语言:javascript
复制
{
    "http-basic": {
        "satis.example.co.uk": {
            "username": "my-username",
            "password": "my-password"
        }
    }
}

运行composer install将给出以下输出:

代码语言:javascript
复制
- Installing org/repo-4 (1.0.0): Downloading (failed)    Failed to download org/repo-4 from dist: The "https://api.github.com/repos/Org/Repo4/zipball/128f63b6a91cf71d5cda8f84861254452ff3a1af" file could not be downloaded (HTTP/1.1 404 Not Found)
Now trying to download from source
- Installing org/repo-4 (1.0.0): Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+box359.localdomain+2017-04-18+1416
to retrieve a token. It will be stored in "/home/ubuntu/CashbackEngine/auth.json" for future use by Composer.
Token (hidden):

正如您从上面看到的,它完全忽略了一个事实,即它需要下载的文件位于https://satis.example.co.uk/dist/org/repo-4/repo-4-1.0.0-e1cd03.zip,并且直接跳转到GitHub的源代码中,这并不是期望的结果,因为它是一个私有的GitHub存储库。

看起来它甚至没有意识到有一个不同的dist版本可用。

我的装备有什么问题吗?

任何帮助都是非常感谢的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-18 15:12:10

这个问题与composer.lock文件有关。

尽管Satis上的dist URL是正确的,但composer甚至没有注意到它,因为composer锁文件缓存了位于GitHub的旧dist url。

解决方案是删除composer.lock文件并运行composer install。我还预先运行了一个composer clearcache,只是为了确保。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43474848

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档