通过 Laravel 安装程序安装 Laravel

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26978145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:26:14  来源:igfitidea点击:

Installing Laravel via the Laravel installer

laravel

提问by panthro

I have composer installed, but checking the Laravel docs, I'm struggling with:

我已经安装了 Composer,但检查 Laravel 文档,我正在努力:

"Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal."

“确保将 ~/.composer/vendor/bin 目录放在 PATH 中,以便在终端中运行 laravel 命令时找到 laravel 可执行文件。”

I'm not sure what to do here, could someone explain it to me?

我不知道在这里做什么,有人可以向我解释一下吗?

回答by Hector diaz valenzuela

Go to terminal and paste the next line:

转到终端并粘贴下一行:

nano ~/.bash_profile

After that paste the next line in nano:

之后在nano中粘贴下一行:

export PATH="$PATH:$HOME/.composer/vendor/bin"

Done. Restart your terminal and enjoy laravel.

完毕。重启你的终端并享受 laravel。

回答by Inda5th

The PATHenvironment variable tells your system where to look when you run a command. By default ~/.composer/vendor/binwill not be in your PATH. Therefore, if you just attempt to run the command laravelafter installing it via composer, your terminal will give you an error saying the command is not found. But if you use the entire path to the command (~/.composer/vendor/bin/laravel), it will execute successfully.

PATH当您运行命令时,环境变量会告诉您的系统在哪里查看。默认情况下~/.composer/vendor/bin不会在您的PATH. 因此,如果您只是laravel在通过 composer 安装后尝试运行该命令,您的终端将提示您未找到该命令。但是,如果您使用命令 ( ~/.composer/vendor/bin/laravel)的整个路径,它将成功执行。

When you run the command composer global require "laravel/installer=~1.1", composer puts the laravel installer into the directory ~/.composer/vendor/bin(in *nix, ~represents your home directory). Adding ~/.composer/vendor/binto your PATHallows you to just execute the command laravelinstead of having to use the full path of ~/.composer/vendor/bin/laravel.

当您运行命令时composer global require "laravel/installer=~1.1",composer 将 laravel 安装程序放入目录~/.composer/vendor/bin(在 *nix 中,~代表您的主目录)。添加~/.composer/vendor/bin到您的PATH允许您只执行命令laravel而不必使用~/.composer/vendor/bin/laravel.

Helpful Stuff:

有用的东西:

How to set/change your PATH environment variable in OSX

如何在 OSX 中设置/更改 PATH 环境变量

Installing composer packages globally

全局安装 composer 包