gpt4 book ai didi

php - Composer 可以在不实际下载软件包的情况下生成 `composer.lock` 吗?

转载 作者:行者123 更新时间:2023-12-02 20:48:10 27 4
gpt4 key购买 nike

确实存在从 composer.json 生成 composer.lock 的命令吗?

类似于 ruby​​ 的 bundler :$bundle lock

最佳答案

如果您没有composer.lock

答案是“否”,您必须使用以下方法生成锁定文件:

composer install

Installing Without composer.lock

If you have never run the command before and there is also no composer.lock file present, Composer simply resolves all dependencies listed in your composer.json file and downloads the latest version of their files into the vendor directory in your project.

来源:getcomposer.org

注意潜在问题:如果没有锁定文件,Composer 将使用最新版本的依赖项。

如果您已经有 composer.lock

如果您已经有一个 composer.lock 并且 Composer 提示它不同步,您将看到此警告:

Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.

要解决此问题,您可以更新锁定文件本身,而不更新依赖项。这只会更新锁定文件中的 content-hash:

composer update --lock

来自 Composer 手册:

--lock Only updates the lock file hash to suppress warning about the lock file being out of date.

关于php - Composer 可以在不实际下载软件包的情况下生成 `composer.lock` 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44805083/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com