简体   繁体   English

composer.phar安装旧包

[英]composer.phar install older packages

I have a problem with "Composer" When I use Composer from my notebook with Linux operating system, Composer install older versions of components than those installed. 我遇到“Composer”问题当我在笔记本电脑上使用Composer和Linux操作系统时,Composer会安装旧版本的组件而不是安装的组件。 When I use Composer from my Windows PC in the office everything works fine (using the same "composer.phar" file under version control). 当我在办公室的Windows PC上使用Composer时,一切正常(在版本控制下使用相同的“composer.phar”文件)。

What could be the problem? 可能是什么问题呢? The command I use is php composer.phar update from project directory. 我使用的命令是项目目录中的php composer.phar update

Thanks in advance for your answers 提前感谢您的回答

Most likely this is because you have a composer.lock file on your linux machine. 这很可能是因为你的linux机器上有一个composer.lock文件。 Composer has two main commands: install and update . Composer有两个主要命令: installupdate

Install will check if a composer.lock file is present. 安装将检查是否存在composer.lock文件。 If it is, that file will be used to determine which versions of the dependencies to install. 如果是,则该文件将用于确定要安装的依赖项的版本。 If not, it will implicitly do an update to get the latest matching versions. 如果没有,它将隐式进行update以获取最新的匹配版本。

Update will always try to get the latest matching versions and then write those into the composer.lock file. Update将始终尝试获取最新的匹配版本,然后将其写入composer.lock文件。

The suggestion here would be to: 这里的建议是:

  • Commit your composer.lock into version control (remove it from .gitignore ). composer.lock提交到版本控制(从.gitignore删除)。
  • Run composer update on your linux machine to get the latest versions. 在Linux机器上运行composer update以获取最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM