无法使用 composer (version 2.1.4) 创建 laravel 项目

2022-01-21 00:00:00 php composer-php

我正在尝试使用 composer 创建一个 laravel 项目 当我跑步时

I'm trying to create a laravel project with composer and when I run

composer create-project laravel/laravel example-app

在终端中,进程停止并出现以下错误:

in the terminal, the process stops with the following error:

[RuntimeException]
php: does not exist and could not be created.

我有 php 7.4 通过 Wampserver 运行,我已将它的 PATH 添加到环境变量中,当我在终端中运行 php -v 时,一切似乎都很好:

I have php 7.4 running through Wampserver and I've added it's PATH to the environment variables and when I run php -v in the terminal, everything seems fine:

PHP 7.4.0 (cli) (built: Nov 27 2019 10:14:18) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

我在这里错过了什么?我使用的是 composer 版本 2.1.4,在管理模式下运行命令也没有什么不同.

what am I missing here? I'm using composer version 2.1.4 and running the command in administrative mode didn't make a difference neither.

在命令行运行命令的屏幕截图

推荐答案

通过运行以下命令更新到 Composer 2.1.5 版本:

Update to version 2.1.5 of Composer by running this command:

composer self-update

这是一个错误,现已修复.它试图创建一个名为 php: 的目录,这在 Windows 系统上是不可能的.

This was a bug that has since been fixed. It was attempting to create a directory called php: which is not possible on Windows systems.

相关文章