问题描述
我正在尝试使用 Laravel Installer 方法在 Windows 上安装 Laravel 框架.
I’m trying to install the Laravel Framework on Windows with the Laravel Installer method.
在文档中我发现了以下内容:
In the documentation I found the following:
首先,使用 Composer 下载 Laravel 安装程序.确保将~/.composer/vendor/bin"目录放在你的 PATH 中,这样laravel 可执行文件是在你运行 laravel 命令时找到的终端.
现在这个 PATH 对我来说并不熟悉.你能告诉我Windows的工作路径吗?
Now this PATH does not look familiar to me. Could you tell me the working path for Windows?
顺便说一句:我正在使用 WAMP.Composer 已安装并更新.
推荐答案
Windows 的 PATH:
我找到了 composer 存储 Vendor 文件的位置.
The PATH for Windows:
I’ve found the location where composer stores the Vendor files.
因此,在 Windows 上应使用以下路径,而不是 ~/.composer/vendor/bin
:
So instead of ~/.composer/vendor/bin
, on Windows the following path should be used:
C:Users<COMPUTER NAME>AppDataRoamingComposervendorin
如何安装 Laravel 安装程序:=======
我假设你的 PATH 中已经有 php 和 composer.
How to install the Laravel Installer:=======
I assume you have php and composer in your PATH already.
首先安装 Laravel Installer. 打开命令提示符并输入:
First of all install the Laravel Installer. Open a command prompt and enter:
composer global require "laravel/installer=~1.1"
**然后通过例如更新 PATH 环境变量**具有管理员权限的命令提示符:
**Then update the PATH environment variable** via e.g. command prompt with admin privileges:
set PATH=%PATH%;%USERPROFILE%AppDataRoamingComposervendorin
// setx /M path "%path%;%appdata%Composervendorin" (this may destroy your system)
%appdata% 已添加,因此您无需担心添加计算机名称.
如何创建一个全新的 Laravel 安装:
现在你应该可以在命令提示符下运行 laravel 命令了.
%appdata% is added, so you don’t have to worry about adding your computer name.
How to create a fresh Laravel Installation:
Now you should be able to run laravel commands in the command prompt.
要创建全新的 laravel 安装,请在选择的目录中打开命令提示符并输入:
To create a fresh laravel installation, open a command prompt in the directory of choice and enter:
laravel new name_of_directory
如果一切正常,您应该会看到以下消息:
If everything went right, you should see the following message:
制作应用程序...
申请准备好了!打造令人惊叹的东西.
这篇关于如何在 Windows 上通过 Laravel Installer 安装 Laravel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!