无法安装 Laravel OSX Catalina

Posted

技术标签:

【中文标题】无法安装 Laravel OSX Catalina【英文标题】:Can't Install Laravel OSX Catalina 【发布时间】:2020-05-25 03:15:46 【问题描述】:

在旧版本上成功使用多年后尝试升级 Laravel 并升级到 OSX 10.15.2 (Catalina) 之后,我似乎无法再为 cli 安装 Laravel。

# php -v
PHP 7.2.24 (cli) (built: Oct 24 2019 13:01:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24, Copyright (c) 1999-2018, by Zend Technologies
# composer --version
composer --version
Composer version 1.9.3 2020-02-04 12:58:49
# composer global require laravel/installer
Changed current directory to /Users/$username/.composer
Using version ^3.0 for laravel/installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install laravel/installer v3.0.1
    - Conclusion: remove symfony/console v3.4.37
    - Installation request for laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1].
    - Conclusion: don't install symfony/console v3.4.37
    - laravel/installer v3.0.0 requires symfony/console ^4.0|^5.0 -> satisfiable by symfony/console[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.1, v4.2.10, v4.2.11, v4.2.12, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.1, v4.3.10, v4.3.11, v4.3.2, v4.3.3, v4.3.4, v4.3.5, v4.3.6, v4.3.7, v4.3.8, v4.3.9, v4.4.0, v4.4.1, v4.4.2, v4.4.3, v4.4.4, v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.0.4].
    - Can only install one of: symfony/console[v4.0.0, v3.4.37].
    - Can only install one of: symfony/console[v4.0.1, v3.4.37].
    - Can only install one of: symfony/console[v4.0.10, v3.4.37].
    - Can only install one of: symfony/console[v4.0.11, v3.4.37].
    - Can only install one of: symfony/console[v4.0.12, v3.4.37].
    - Can only install one of: symfony/console[v4.0.13, v3.4.37].
    - Can only install one of: symfony/console[v4.0.14, v3.4.37].
    - Can only install one of: symfony/console[v4.0.15, v3.4.37].
    - Can only install one of: symfony/console[v4.0.2, v3.4.37].
    - Can only install one of: symfony/console[v4.0.3, v3.4.37].
    - Can only install one of: symfony/console[v4.0.4, v3.4.37].
    - Can only install one of: symfony/console[v4.0.5, v3.4.37].
    - Can only install one of: symfony/console[v4.0.6, v3.4.37].
    - Can only install one of: symfony/console[v4.0.7, v3.4.37].
    - Can only install one of: symfony/console[v4.0.8, v3.4.37].
    - Can only install one of: symfony/console[v4.0.9, v3.4.37].
    - Can only install one of: symfony/console[v4.1.0, v3.4.37].
    - Can only install one of: symfony/console[v4.1.1, v3.4.37].
    - Can only install one of: symfony/console[v4.1.10, v3.4.37].
    - Can only install one of: symfony/console[v4.1.11, v3.4.37].
    - Can only install one of: symfony/console[v4.1.12, v3.4.37].
    - Can only install one of: symfony/console[v4.1.2, v3.4.37].
    - Can only install one of: symfony/console[v4.1.3, v3.4.37].
    - Can only install one of: symfony/console[v4.1.4, v3.4.37].
    - Can only install one of: symfony/console[v4.1.5, v3.4.37].
    - Can only install one of: symfony/console[v4.1.6, v3.4.37].
    - Can only install one of: symfony/console[v4.1.7, v3.4.37].
    - Can only install one of: symfony/console[v4.1.8, v3.4.37].
    - Can only install one of: symfony/console[v4.1.9, v3.4.37].
    - Can only install one of: symfony/console[v4.2.0, v3.4.37].
    - Can only install one of: symfony/console[v4.2.1, v3.4.37].
    - Can only install one of: symfony/console[v4.2.10, v3.4.37].
    - Can only install one of: symfony/console[v4.2.11, v3.4.37].
    - Can only install one of: symfony/console[v4.2.12, v3.4.37].
    - Can only install one of: symfony/console[v4.2.2, v3.4.37].
    - Can only install one of: symfony/console[v4.2.3, v3.4.37].
    - Can only install one of: symfony/console[v4.2.4, v3.4.37].
    - Can only install one of: symfony/console[v4.2.5, v3.4.37].
    - Can only install one of: symfony/console[v4.2.6, v3.4.37].
    - Can only install one of: symfony/console[v4.2.7, v3.4.37].
    - Can only install one of: symfony/console[v4.2.8, v3.4.37].
    - Can only install one of: symfony/console[v4.2.9, v3.4.37].
    - Can only install one of: symfony/console[v4.3.0, v3.4.37].
    - Can only install one of: symfony/console[v4.3.1, v3.4.37].
    - Can only install one of: symfony/console[v4.3.10, v3.4.37].
    - Can only install one of: symfony/console[v4.3.11, v3.4.37].
    - Can only install one of: symfony/console[v4.3.2, v3.4.37].
    - Can only install one of: symfony/console[v4.3.3, v3.4.37].
    - Can only install one of: symfony/console[v4.3.4, v3.4.37].
    - Can only install one of: symfony/console[v4.3.5, v3.4.37].
    - Can only install one of: symfony/console[v4.3.6, v3.4.37].
    - Can only install one of: symfony/console[v4.3.7, v3.4.37].
    - Can only install one of: symfony/console[v4.3.8, v3.4.37].
    - Can only install one of: symfony/console[v4.3.9, v3.4.37].
    - Can only install one of: symfony/console[v4.4.0, v3.4.37].
    - Can only install one of: symfony/console[v4.4.1, v3.4.37].
    - Can only install one of: symfony/console[v4.4.2, v3.4.37].
    - Can only install one of: symfony/console[v4.4.3, v3.4.37].
    - Can only install one of: symfony/console[v4.4.4, v3.4.37].
    - Can only install one of: symfony/console[v5.0.0, v3.4.37].
    - Can only install one of: symfony/console[v5.0.1, v3.4.37].
    - Can only install one of: symfony/console[v5.0.2, v3.4.37].
    - Can only install one of: symfony/console[v5.0.3, v3.4.37].
    - Can only install one of: symfony/console[v5.0.4, v3.4.37].
    - Installation request for symfony/console (locked at v3.4.37) -> satisfiable by symfony/console[v3.4.37].


Installation failed, reverting ./composer.json to its original content.

我在这里和其他地方花了 2 天时间研究建议,但没有成功解决此问题。非常感谢任何建议。

【问题讨论】:

【参考方案1】:

您的 /Users/$username/.composer/composer.lock 文件中似乎有不兼容的硬编码依赖项

我也遇到过这个问题,原来我的 laravel/homestead 和 laravel/valet 使用的是旧版本的 symfony/console。

简单修复:

1. composer global remove laravel/homestead
2. composer global remove laravel/valet
3. Finally, composer global install laravel/installer

【讨论】:

【参考方案2】:

经过一系列的随机尝试,我终于可以跑了:

composer global update

然后

composer global require laravel/installer

这似乎解决了问题。

【讨论】:

我遇到了同样的问题,但使用 guzzlehttp/guzzle。它也解决了它。

以上是关于无法安装 Laravel OSX Catalina的主要内容,如果未能解决你的问题,请参考以下文章

新的 Laravel 安装给 Mcrypt “错误”。 (OSX)

在 OSX 上安装 laravel 后 localhost 不工作

使用MAMP在OSX上安装Laravel 5.1

让 Laravel 5 使用 xampp for OSX

Mac OSX Catalina: can’t be opened because Apple cannot check for malicious software

MobileDevice.pkg 不受信任,在 OS X 更新后无法打开 Xcode