php 作曲家更新 Laravel

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24782960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 17:28:14  来源:igfitidea点击:

Composer Update Laravel

phplaravelcomposer-php

提问by Brent

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>

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

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

回答by Kryten

When you run composer update, composergenerates a file called composer.lockwhich 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 update,会composer生成一个名为的文件composer.lock,其中列出了您的所有软件包和当前安装的版本。这允许您稍后运行composer install,这将安装该文件中列出的软件包,重新创建您上次使用的环境。

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

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

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

但是,您遇到了不同的问题。看起来,在您的composer.json文件中,原始开发人员添加了一些失败的更新前或更新后操作,特别是php artisan migrate命令。这可以通过运行以下命令来避免: 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.

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

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

然而,这并不能长期解决问题。有两个问题:

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

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

  1. 迁移用于数据库更改,而不是像编译资产这样的随机内容。完成迁移并从那里删除该代码。

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

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.

从我读过的内容来看,最佳实践似乎是在开发期间(即,当您对 LESS 文件进行更改时 - 最好使用gulp.js 之类的工具)和部署之前根据需要编译资产。

回答by Ghulam Akbar

The following works for me:

以下对我有用:

composer update --no-scripts

回答by hassan shaikh

this is command for composer update please try this...

这是作曲家更新的命令,请试试这个...

composer self-update

作曲家自我更新