【问题标题】:Composer found when running directly, but not when running artisan直接运行时发现composer,运行artisan时发现不到
【发布时间】:2023-02-07 04:13:02
【问题描述】:

我正在帮助使用 OctoberCMS 的网站工作。我试图更新到最新版本,但是当我运行 Artisan 命令更新 October 时,出现以下错误:

$ php artisan october:update
Updating October CMS...
Executing: composer update

'composer' is not recognized as an internal or external command, operable program or batch file.

[ERROR] Update failed. Check output above

但是,如果我直接运行composer update,它会按预期工作:

$ composer update
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
> System\Console\ComposerScript::postAutoloadDump

   INFO  Discovering packages.

  laravel/tinker .............................................................................. DONE
  nesbot/carbon ............................................................................... DONE
  nunomaduro/termwind ......................................................................... DONE
  october/rain ................................................................................ DONE

94 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> System\Console\ComposerScript::postUpdateCmd
No security vulnerability advisories found

自从我进行大量 PHP 开发以来已经将近 10 年了,所以我的 Composer-fu 有点生疏了。如果需要更多信息来帮助诊断正在发生的事情,请告诉我!

环境:
Windows 11 专业版
Git Bash(在 ConEmu 中运行)
PHP 8.1.3
作曲家 2.4.4

【问题讨论】:

    标签: composer-php laravel-artisan octobercms


    【解决方案1】:

    您可以尝试在命令行/powershell 中运行 composer 吗?

    'composer' is not recognized as an internal or external command, operable program or batch file. 不是 Git Bash 或类似终端的 linux 会产生的响应。

    我认为 artisan 正试图在 Windows shell 中运行 composer 并且无法在你的 PATH 中找到它,但由于某种原因你在你的 Git Bash 路径中有它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-01
      • 2013-09-05
      • 2019-06-26
      • 1970-01-01
      • 1970-01-01
      • 2016-09-26
      • 2021-07-02
      • 2021-05-22
      相关资源
      最近更新 更多