简体   繁体   English

尝试通过composer在windows上安装laravel/创建laravel项目时出错

[英]Error when trying to install laravel/create a laravel project on windows via composer

I want to create a new project using Laravel.我想使用 Laravel 创建一个新项目。

From the documentation, I downloaded Composer using its Windows executable installer.从文档中,我使用其 Windows 可执行安装程序下载了 Composer。

I have already set the path to: C:\\Users\\marti\\AppData\\Roaming\\Composer\\vendor\\bin我已经将路径设置为:C:\\Users\\marti\\AppData\\Roaming\\Composer\\vendor\\bin

**I created the vendor\\bin directory **我创建了 vendor\\bin 目录

From the command prompt, the command "composer" works.在命令提示符下,命令“composer”起作用。 I tried to install Laravel using the laravel installer and it gives me an error also with the create-project command.我尝试使用 laravel 安装程序安装 Laravel,它也给我一个使用 create-project 命令的错误。 I have tried both methods even with administrative privillages but still there is an error.即使使用管理权限,我也尝试过这两种方法,但仍然存在错误。

Using Laravel Installer:使用 Laravel 安装程序:

[ErrorException] file_put_contents(C:\\Users\\marti\\AppData\\Roaming\\Composer\\vendor\\bin): failed to open stream: Permission denied [ErrorException] file_put_contents(C:\\Users\\marti\\AppData\\Roaming\\Composer\\vendor\\bin):无法打开流:权限被拒绝

Using create-project method:使用创建项目方法:

[InvalidArgumentException] Composer could not find the config file: C:\\Users\\marti\\AppData\\Roaming\\Composer\\vendor\\bin To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting S tarted" section [InvalidArgumentException] Composer 找不到配置文件:C:\\Users\\marti\\AppData\\Roaming\\Composer\\vendor\\bin 要初始化项目,请按照https://getcomposer.org 中的描述创建 composer.json 文件/ “入门”部分

PLEASE HELP!请帮忙!

Error when using laravel installer使用 Laravel 安装程序时出错

Error when using create-project method使用 create-project 方法时出错

我删除了 Composer 路径变量,将目录更改为“C:>”并运行命令“composer global require laravel/installer”

尝试从 composer composer global require laravel/installer 中要求 Laravel 安装程序,然后简单地创建一个新的 Laravel 项目laravel new {PROJECT_NAME}

Composer(for windows), as of build v1.10.13 does not require you to manually set then env path variable . Composer(适用于 Windows),从 build v1.10.13 ,不需要您手动设置env path variable

You dont have to change or add anything in the composer installation directory or to environment path variable.您不必在 composer 安装目录或环境路径变量中更改或添加任何内容。

If you have done so, then do the following如果您这样做了,请执行以下操作

  • Re-install composer.重新安装作曲家。
  • Run composer in a new cmd window, to see if its is installed properly.在新的cmd窗口中运行composer ,看看它是否安装正确。
  • Run composer create-project --prefer-dist laravel/laravel <your project name> and now your project should be set up properly.运行composer create-project --prefer-dist laravel/laravel <your project name>现在你的项目应该被正确设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM