找不到 laravel 命令设置路径不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45567481/
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
laravel command not found setting path does not work
提问by Nigel Smith
I am have installed laravel via composer using the following procedure in my Ubuntu 17.04 running on the latest Oracle Virtualbox:
我已经在我的 Ubuntu 17.04 中使用以下过程通过 Composer 安装了 laravel,在最新的 Oracle Virtualbox 上运行:
Steps:
脚步:
1) composer global require "laravel/installer"
1) composer global require "laravel/installer"
2) nano .bashrc
2) nano .bashrc
3) I added export PATH="$PATH:$HOME/.composer/vendor/bin"
3)我添加了导出 PATH="$PATH:$HOME/.composer/vendor/bin"
4) saved changes.
4) 保存更改。
I even added this line to .profile logged out then back in again but I am still getting laravel command not found.
我什至将此行添加到 .profile 注销然后重新登录,但我仍然找不到 laravel 命令。
What am I doing wrong?
我究竟做错了什么?
回答by Yuyang He
回答by Oluwatobi Samuel Omisakin
You can save yourself the headache: install from composer:
您可以省去头疼的麻烦:从作曲家安装:
composer create-project --prefer-dist laravel/laravel blog
blog
is your project's name
blog
是你的项目名称
回答by Shashi Asanka Nawarathna
I had the same problem with my Linux Mint. Check the composer folder path if this in ~/.config/composer
then you need to change the $PATH
variable looks like below.
This should solve the problem:
我的 Linux Mint 也有同样的问题。检查 Composer 文件夹路径,如果是这样,~/.config/composer
那么您需要更改$PATH
如下所示的变量。这应该可以解决问题:
nano .bashrc [ or nano .bash_profile ]
export PATH=~/.config/composer/vendor/bin:$PATH [ Add this line and save it ]
source .bashrc
nano .bashrc [ or nano .bash_profile ]
export PATH=~/.config/composer/vendor/bin:$PATH [ Add this line and save it ]
source .bashrc
回答by dilantha111
Sometimes Laravel is not in that path. Instead try ~/.config/composer/vender/bin/. But make sure that laravel is exist in that path.
有时 Laravel 不在这条道路上。而是尝试 ~/.config/composer/vender/bin/。但请确保该路径中存在 laravel。
回答by Lerie Taylor
This is most likely because you haven't set the directory properly. I installed laravel as root so my directory was "/root/.composer/vendor/bin". Navigate to your home directory and do the following:
这很可能是因为您没有正确设置目录。我以 root 身份安装了 laravel,所以我的目录是“/root/.composer/vendor/bin”。导航到您的主目录并执行以下操作:
- vi .profile
- add /root/.composer/vendor/binto the $PATH variable
- save file (:wq)
- source profile by typing: source .profile
- vi .profile
- 将/root/.composer/vendor/bin添加到 $PATH 变量
- 保存文件 (:wq)
- 输入源配置文件:source .profile
-- remember, never install via root on a production server --
-- 记住,永远不要在生产服务器上通过 root 安装 --