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

Composer Error Installing laravel/installer in Windows 10

我正在使用 Windows 10 和作曲家。我在尝试安装 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>]...

这通常发生在本地环境中的文件损坏时。尝试删除缓存和 re-installing 包

$ composer clearcache
$ composer global require laravel/installer

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

您对 symfony/polyfill
有疑问 手动删除供应商和composer.lock


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

composer clearcache

然后 安装你的包

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

清除缓存对我也有用。 这是我的工作:

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