尽管已经下载了composer和xampp,但创建Laravel项目时遇到问题
P粉276876663
P粉276876663 2023-11-08 22:03:54
0
1
962

所以,我使用的是 Windows 10,并且安装了最新版本的 Xampp。 然后安装Composer。 然后我在 xampp 的 htdocs 文件夹中打开命令提示符并运行以下命令:

composer create-project laravel/laravel myfirstapp

我收到以下错误:

Creating a "laravel/laravel" project at "./myfirstapp2"
Info from https://repo.packagist.org: #StandWithUkraine
Installing laravel/laravel (v9.5.0)
    Failed to download laravel/laravel from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing laravel/laravel (v9.5.0) into cache
  - Installing laravel/laravel (v9.5.0): Cloning 091aa7d882 from cache
Created project in C:xampphtdocsmyfirstapp2
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Lock file operations: 107 installs, 0 updates, 0 removals
  - Locking brick/math (0.10.2)
  - Locking dflydev/dot-access-data (v3.0.2)
  - Locking doctrine/deprecations (v1.0.0)
  - Locking doctrine/inflector (2.0.6)
  - Locking doctrine/instantiator (2.0.0)
  - Locking doctrine/lexer (2.1.0)
  - Locking dragonmantank/cron-expression (v3.3.2)
  - Locking egulias/email-validator (3.2.5)
  - Locking fakerphp/faker (v1.21.0)
  - Locking filp/whoops (2.14.6)
  - Locking fruitcake/php-cors (v1.2.0)
  - Locking graham-campbell/result-type (v1.1.0)
  - Locking guzzlehttp/guzzle (7.5.0)
  - Locking guzzlehttp/promises (1.5.2)
  - Locking guzzlehttp/psr7 (2.4.3)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking laravel/framework (v9.47.0)
  - Locking laravel/pint (v1.4.0)
  - Locking laravel/sail (v1.18.0)
  - Locking laravel/sanctum (v3.2.0)
  - Locking laravel/serializable-closure (v1.2.2)
  - Locking laravel/tinker (v2.8.0)
  - Locking league/commonmark (2.3.8)
  - Locking league/config (v1.2.0)
  - Locking league/flysystem (3.12.1)
  - Locking league/mime-type-detection (1.11.0)
  - Locking mockery/mockery (1.5.1)
  - Locking monolog/monolog (2.8.0)
  - Locking myclabs/deep-copy (1.11.0)
  - Locking nesbot/carbon (2.65.0)
  - Locking nette/schema (v1.2.3)
  - Locking nette/utils (v3.2.8)
  - Locking nikic/php-parser (v4.15.2)
  - Locking nunomaduro/collision (v6.4.0)
  - Locking nunomaduro/termwind (v1.15.0)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phpoption/phpoption (1.9.0)
  - Locking phpunit/php-code-coverage (9.2.23)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.5.28)
  - Locking psr/container (2.0.2)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.1)
  - Locking psr/http-factory (1.0.1)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (3.0.0)
  - Locking psr/simple-cache (3.0.0)
  - Locking psy/psysh (v0.11.10)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (2.0.0)
  - Locking ramsey/uuid (4.7.3)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.8)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.4)
  - Locking sebastian/exporter (4.0.5)
  - Locking sebastian/global-state (5.0.5)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.4)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (3.2.0)
  - Locking sebastian/version (3.0.2)
  - Locking spatie/backtrace (1.2.1)
  - Locking spatie/flare-client-php (1.3.2)
  - Locking spatie/ignition (1.4.1)
  - Locking spatie/laravel-ignition (1.6.4)
  - Locking symfony/console (v6.2.3)
  - Locking symfony/css-selector (v6.2.3)
  - Locking symfony/deprecation-contracts (v3.2.0)
  - Locking symfony/error-handler (v6.2.3)
  - Locking symfony/event-dispatcher (v6.2.2)
  - Locking symfony/event-dispatcher-contracts (v3.2.0)
  - Locking symfony/finder (v6.2.3)
  - Locking symfony/http-foundation (v6.2.2)
  - Locking symfony/http-kernel (v6.2.4)
  - Locking symfony/mailer (v6.2.2)
  - Locking symfony/mime (v6.2.2)
  - Locking symfony/polyfill-ctype (v1.27.0)
  - Locking symfony/polyfill-intl-grapheme (v1.27.0)
  - Locking symfony/polyfill-intl-idn (v1.27.0)
  - Locking symfony/polyfill-intl-normalizer (v1.27.0)
  - Locking symfony/polyfill-mbstring (v1.27.0)
  - Locking symfony/polyfill-php72 (v1.27.0)
  - Locking symfony/polyfill-php80 (v1.27.0)
  - Locking symfony/polyfill-uuid (v1.27.0)
  - Locking symfony/process (v6.2.0)
  - Locking symfony/routing (v6.2.3)
  - Locking symfony/service-contracts (v3.2.0)
  - Locking symfony/string (v6.2.2)
  - Locking symfony/translation (v6.2.3)
  - Locking symfony/translation-contracts (v3.2.0)
  - Locking symfony/uid (v6.2.0)
  - Locking symfony/var-dumper (v6.2.3)
  - Locking theseer/tokenizer (1.2.1)
  - Locking tijsverkoyen/css-to-inline-styles (2.2.6)
  - Locking vlucas/phpdotenv (v5.5.0)
  - Locking voku/portable-ascii (2.0.1)
  - Locking webmozart/assert (1.11.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 107 installs, 0 updates, 0 removals
    Failed to download doctrine/inflector from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing doctrine/inflector (2.0.6) into cache
    Failed to download doctrine/deprecations from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing doctrine/deprecations (v1.0.0) into cache
    Failed to download doctrine/lexer from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing doctrine/lexer (2.1.0) into cache
    Failed to download symfony/polyfill-ctype from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing symfony/polyfill-ctype (v1.27.0) into cache
    Failed to download webmozart/assert from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing webmozart/assert (1.11.0) into cache
    Failed to download dragonmantank/cron-expression from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing dragonmantank/cron-expression (v3.3.2) into cache
    Failed to download symfony/deprecation-contracts from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing symfony/deprecation-contracts (v3.2.0) into cache
    Failed to download psr/container from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing psr/container (2.0.2) into cache
    Failed to download fakerphp/faker from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing fakerphp/faker (v1.21.0) into cache
    Failed to download symfony/polyfill-mbstring from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing symfony/polyfill-mbstring (v1.27.0) into cache
    Failed to download symfony/http-foundation from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing symfony/http-foundation (v6.2.2) into cache
    Failed to download fruitcake/php-cors from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing fruitcake/php-cors (v1.2.0) into cache
    Failed to download psr/http-message from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing psr/http-message (1.0.1) into cache
    Failed to download psr/http-client from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing psr/http-client (1.0.1) into cache
    Failed to download ralouphie/getallheaders from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing ralouphie/getallheaders (3.0.3) into cache
    Failed to download psr/http-factory from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing psr/http-factory (1.0.1) into cache
    Failed to download guzzlehttp/psr7 from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing guzzlehttp/psr7 (2.4.3) into cache
    Failed to download guzzlehttp/promises from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing guzzlehttp/promises (1.5.2) into cache
    Failed to download guzzlehttp/guzzle from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing guzzlehttp/guzzle (7.5.0) into cache
    Failed to download laravel/pint from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  - Syncing laravel/pint (v1.4.0) into cache
    Failed to download voku/portable-ascii from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:xamppphpphp.ini
    Now trying to download from source
  ....

并且它会不断尝试同步所有无法下载的内容,永无休止的循环。

据我了解,php.ini 中缺少扩展名?我只能在 php.ini 文件中找到 sqlite 扩展。 我该如何解决这个问题?我应该编辑 php.ini 文件并添加扩展吗?为 laravel 9 和 php 8.2 添加哪些扩展?

P粉276876663
P粉276876663

全部回复(1)
P粉668804228

如下所述: https:// /www.php.net/manual/en/zip.installation.php#zip.installation.new.windows

您需要在 php.ini 中手动启用此扩展。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板