作曲家更新Laravel [英] Composer Update Laravel

查看:74
本文介绍了作曲家更新Laravel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开发人员已将他的项目发送给我,但是当我尝试更新或安装我的供应商时,一切都很好,直到最后并输出以下消息.

A developer has sent me his project to work with, but when ever I try to update or install my vendors everything works great until the very end and it outputs the message bellow.

C:\xampp\htdocs\BigWaveMedia\davinkit>php artisan migrate
{
    "error": {
        "type": "Exception",
        "message": "expected color value: failed at `.clearfix;` C:\\xampp\\htdocs\\BigWaveMedia\\davinkit\\app\\start\/..\/..\/public\/less\/style.less on line 102",
        "file": "C:\\xampp\\htdocs\\davinkit\\vendor\\leafo\\lessphp\\lessc.inc.php",
        "line": 3258
    }
}
C:\xampp\htdocs\BigWaveMedia\davinkit>

有什么想法吗?这是完整的日志 http://pastebin.com/y9q4Rc5z

Any ideas at all? Here is a full log http://pastebin.com/y9q4Rc5z

推荐答案

运行composer update时,composer会生成一个名为composer.lock的文件,其中列出了所有软件包和当前安装的版本.这样一来,您以后就可以运行composer install,它将安装该文件中列出的软件包,从而重新创建您上次使用的环境.

When you run composer update, composer generates a file called composer.lock which lists all your packages and the currently installed versions. This allows you to later run composer install, which will install the packages listed in that file, recreating the environment that you were last using.

从您的日志中看来,composer.lock文件中列出的某些软件包版本不再可用.因此,当您运行composer install时,它会抱怨并失败.通常这没什么大不了的-只需运行composer update,它将尝试构建一组可以一起工作的程序包并编写一个新的composer.lock文件.

It appears from your log that some of the versions of packages that are listed in your composer.lock file are no longer available. Thus, when you run composer install, it complains and fails. This is usually no big deal - just run composer update and it will attempt to build a set of packages that work together and write a new composer.lock file.

但是,您遇到了另一个问题.看来,原始开发人员在您的composer.json文件中添加了一些失败的更新前或更新后操作,特别是php artisan migrate命令.通过运行以下命令可以避免这种情况:composer update --no-scripts

However, you're running into a different problem. It appears that, in your composer.json file, the original developer has added some pre- or post- update actions that are failing, specifically a php artisan migrate command. This can be avoided by running the following: composer update --no-scripts

这将运行作曲家更新,但将跳过添加到文件中的脚本.您应该能够以这种方式成功运行更新.

This will run the composer update but will skip over the scripts added to the file. You should be able to successfully run the update this way.

但是,这不能长期解决问题.有两个问题:

However, this does not solve the problem long-term. There are two problems:

  1. 迁移是针对数据库更改的,而不是诸如编译资产之类的随机内容.进行迁移并从那里删除该代码.

  1. A migration is for database changes, not random stuff like compiling assets. Go through the migrations and remove that code from there.

不应在每次运行composer update时都编译资产.从composer.json文件中删除该步骤.

Assets should not be compiled each time you run composer update. Remove that step from the composer.json file.

据我所读,最佳实践似乎是在开发过程中按需编译资产(即,当您对LESS文件进行更改时-最好使用

From what I've read, best practice seems to be compiling assets on an as-needed basis during development (ie. when you're making changes to your LESS files - ideally using a tool like gulp.js) and before deployment.

这篇关于作曲家更新Laravel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆