资源预览内容
第1页 / 共4页
第2页 / 共4页
第3页 / 共4页
第4页 / 共4页
亲,该文档总共4页全部预览完了,如果喜欢就下载吧!
资源描述
Composer设置忽视版本匹配的方法_ Composer简介 Composer 是 PHP 的一个依靠管理工具。它允许你申明项目所依靠的代码库,它会在你的项目中为你安装他们。Composer 不是一个包管理器。是的,它涉及 packages 和 libraries,但它在每个项目的基础上进行管理,在你项目的某个名目中(例如 vendor)进行安装。默认状况下它不会在全局安装任何东西。因此,这仅仅是一个依靠管理。 执行composer install遇到错误:Your requirements could not be resolved to an installable set of packages. 这是由于不匹配composer.json要求的版本。 完整错误如下: vagranthomestead:/usr/share/nginx/html/laravel-blog$ sudo composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for doctrine/instantiator 1.0.3 - satisfiable by doctrine/instantiator1.0.3. - doctrine/instantiator 1.0.3 requires php 5.3 - your PHP version (7.0.3) does not satisfy that requirement. Problem 2 - doctrine/instantiator 1.0.3 requires php 5.3 - your PHP version (7.0.3) does not satisfy that requirement. - phpunit/phpunit-mock-objects 2.3.0 requires doctrine/instantiator 1.0,=1.0.1 - satisfiable by doctrine/instantiator1.0.3. - Installation request for phpunit/phpunit-mock-objects 2.3.0 - satisfiable by phpunit/phpunit-mock-objects2.3.0. 提示我的PHP 7版本太高,不符合composer.json需要的版本,但是在PHP 7下应当也是可以运行的,composer可以设置忽视版本匹配,指令是: composer install -ignore-platform-reqs or composer update -ignore-platform-reqs 再次执行composer指令可以正常安装包了。 假如提示警告: Cannot create cache directory /home/vagrant/.composer/cache/repo/https-packagist.org/, or directory is not writable. Proceeding without cache Cannot create cache directory /home/vagrant/.composer/cache/files/, or directory is not writable. Proceeding without cache 这是在虚拟机中执行composer,提示这个名目没有可写权限,composer无法缓存下载的包,这样就每次都得重新下载,把名目改成可写可读即可。 sudo chmod -R 777 /home/vagrant/.composer/cache/files/ 另外,在虚拟机中也设置composer为国内镜像,不然下载速度慢的要死,执行: composer config -g repo.packagist composer https:/packagist.phpcomposer.com OK,大功告成。 .
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号