![](/img/trans.png)
[英]Can't install laravel installer via composer on MAC (catalina)
[英]Can't install laravel installer via composer
我正在嘗試在我的 Ubuntu PC 上使用 composer 安裝 laravel 安裝程序,但在安裝過程中出現此錯誤。 `您的要求無法解析為一組可安裝的軟件包。
Problem 1
- laravel/installer v1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- laravel/installer v1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for laravel/installer ^1.4 -> satisfiable by laravel/installer[v1.4.0, v1.4.1].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
`
出現錯誤然后我使用此評論:
composer global require "laravel/installer"
它說它需要zip 擴展名
laravel/installer v1.4.0 需要 ext-zip ...
安裝使用(安裝默認版本):
sudo apt install php-zip
或者,如果您運行的是特定版本的 PHP:
# For php v7.0
sudo apt-get install php7.0-zip
# For php v7.1
sudo apt-get install php7.1-zip
# For php v7.2
sudo apt-get install php7.2-zip
# For php v7.3
sudo apt-get install php7.3-zip
# For php v7.4
sudo apt-get install php7.4-zip
對於使用 CATALINA 的 MAC 用戶
首先,安裝自制軟件。 然后說
brew install php@7.3
brew link php@7.3
重新啟動控制台並運行 Laravel 安裝程序
在centos 7上我使用過:
yum install php-pecl-zip
因為任何其他解決方案對我都不起作用。
對於 PHP7.1 安裝這個
sudo apt-get install php7.1-zip
如果您在使用macOS Catalina 時遇到此問題,我建議您執行以下步驟:
安裝 Homebrew(如果您還沒有這樣做):轉到brew.sh或簡單地運行以下命令: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
運行brew install php@7.3
更新您的 $PATH 變量以包含新安裝的 php 版本:
echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.3/sbin:$PATH"' >> ~/.zshrc
重新加載您的 shell 首選項腳本$ source ~/.zshrc
或source ~/.bashrc
最后,安裝laravel: composer global require laravel/installer
對於Ubuntu 16.04
,我已將此命令用於PHP7.2
,它對我PHP7.2
。
sudo apt-get install php7.2-zip
Centos 7 與 PHP7.2:
sudo yum --enablerepo=remi-php72 install php-pecl-zip
V=`php -v | sed -e '/^PHP/!d' -e 's/.* \([0-9]\+\.[0-9]\+\).*$/\1/'` \
sudo apt-get install php$V-zip
對於帶有 Macports 的 Mac,
# port install php71-zip
對於 Ubuntu 18.04 LTS 中的 PHP 7.2
sudo apt-get install php7.2-zip
奇跡般有效
知道你的php版本
php -v
對於 php 7.3.0
sudo apt-get install php7.3-zip
缺少 zip 擴展名,您可以通過簡單地運行以下命令來避免此錯誤,默認情況下它將采用版本
sudo apt-get install php-zip
如果您需要任何特定版本,您需要提及您的 php 的特定版本,假設我需要安裝X
版本的 php-zip,那么命令將是。
sudo apt-get install phpX-zip
用您需要的版本替換X
,在我的情況下,它是X = 7.3
對於 macOS 用戶,您可以改用 Homebrew:
# For php v7.0
brew install php@7.0
# For php v7.1
brew install php@7.1
# For php v7.2
brew install php@7.2
# For php v7.3
brew install php@7.3
# For php v7.4
brew install php@7.4
我將 WSL 與 ubuntu 16.04 LTS 版本與 php 7.3 和 laravel 5.7 一起使用
sudo apt-get install php7.3-zip
為我工作
須藤apt-get install php-zip
這個解決方案對我有用。
以下解決方案為我工作。
首先,檢查您的PHP版本php-v
例如,它是7.2 ,通過安裝zip擴展名
須藤apt-get install php7.2-zip
用您的Php版本替換7.2,然后安裝Lumen或Laravel
作曲家全球需要“ laravel / lumen-installer”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.