-
在安装
laravel-ide-helper
的时候,报错Installation failed, reverting ./composer.json and ./composer.lock to their original content.
$ composer require barryvdh/laravel-ide-helper
报错:
-
解决方法
1、把需要引入的包写入
composer.json
中(写入的话,就不需要composer require
了,直接composer update
即可。)2、删除
composer.lock
3、
$ composer clearcache
清除缓存4、
$ composer update
更新依赖(重新生成composer.lock
)例如:
上面的
laravel-ide-helper
组件,将它加入到composer.json
的require
对象里面,如果只是开发环境使用,就加入到require-dev
,然后按照上面步骤操作一遍:"require": { "php": "^7.1.3", "fideloper/proxy": "^4.0", // 我加到这里 "barryvdh/laravel-ide-helper": "^2.6", "laravel/framework": "5.8.*", "laravel/tinker": "^1.0" }, "require-dev": { "beyondcode/laravel-dump-server": "^1.0", "filp/whoops": "^2.0", "fzaninotto/faker": "^1.4", "mockery/mockery": "^1.0", "nunomaduro/collision": "^3.0", "phpunit/phpunit": "^7.5" },