在 Windows 10 中安装 laravel/installer 时出现 Composer 错误

问题描述 投票:0回答:7

我正在使用 Windows 10 和 Composer。当我尝试安装 laravel 安装程序时出现错误。 任何帮助将不胜感激。 这是我尝试安装时的完整输出:

$ composer global require laravel/installer
Changed current directory to C:/Users/rudy/AppData/Roaming/Composer
Using version ^4.1 for laravel/installer
./composer.json has been created
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Lock file operations: 12 installs, 0 updates, 0 removals
  - Locking laravel/installer (v4.1.0)
  - Locking psr/container (1.0.0)
  - Locking symfony/console (v5.1.8)
  - Locking symfony/polyfill-ctype (v1.20.0)
  - Locking symfony/polyfill-intl-grapheme (v1.20.0)
  - Locking symfony/polyfill-intl-normalizer (v1.20.0)
  - Locking symfony/polyfill-mbstring (v1.20.0)
  - Locking symfony/polyfill-php73 (v1.20.0)
  - Locking symfony/polyfill-php80 (v1.20.0)
  - Locking symfony/process (v5.1.8)
  - Locking symfony/service-contracts (v2.2.0)
  - Locking symfony/string (v5.1.8)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 12 installs, 0 updates, 0 removals
  - Installing symfony/polyfill-php80 (v1.20.0): Extracting archive
  - Installing symfony/process (v5.1.8): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.20.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.20.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.20.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.20.0): Extracting archive
  - Installing symfony/string (v5.1.8): Extracting archive
  - Installing psr/container (1.0.0): Extracting archive
  - Installing symfony/service-contracts (v2.2.0): Extracting archive
  - Installing symfony/polyfill-php73 (v1.20.0): Extracting archive
  - Installing symfony/console (v5.1.8): Extracting archive
  - Installing laravel/installer (v4.1.0): Extracting archive
    Skipped installation of bin bin/laravel for package laravel/installer: name conflicts with an existing file
6 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files

Installation failed, deleting ./composer.json.


  [RuntimeException]
  Could not scan for classes inside "C:\Users\rudy\AppData\Roaming\Composer\vendor/symfony/polyfill-php73/Resources/s
  tubs" which does not appear to be a file nor a folder


require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]...
laravel composer-php laravel-8
7个回答
3
投票

当本地环境中的文件损坏时,通常会发生这种情况。尝试删除缓存并重新安装软件包

$ composer clearcache
$ composer global require laravel/installer

3
投票

您在使用 symfony/polyfill 时遇到问题
手动删除Vendor和composer.lock

或者
清理作曲家缓存对我有用:

composer clearcache

然后 安装你的包


1
投票

对我来说,问题是 7zip。 Composer 使用 Lua 中的 7z.exe(我之前安装过)。 当我从官方网站安装 7z 并更新 PATH 变量时,这个错误得到了解决。
但我无法提供解释,我不确定发生了什么......


0
投票

您可以尝试下载并安装composer.exe


0
投票

在发表这篇文章之前,我重新安装了 Composer 4 次。 在尝试上述解决方案失败后,我尝试再次重新安装 Composer,然后运行 laravel/installer - 它工作正常。感谢所有花时间回复的人。


0
投票

清除缓存也对我有用。 这是我所做的:

  1. 作曲家清除缓存
  2. composer 全局需要 laravel/installer 安装成功了

0
投票

我在使用 7 zip 时遇到问题,我通过在 php.ini 中启用 zip 扩展来修复它

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.