简体   繁体   English

Laravel安装/配置-找不到命令

[英]Laravel Installation/Configuration - Command Not Found

Trying to install Laravel on Ubuntu Server 14.04. 尝试在Ubuntu Server 14.04上安装Laravel。 After installing PHP 7 I enter: 安装PHP 7后,我输入:

curl -sS https://getcomposer.org/installer | php

I get: Composer successfully installed to: /home/ubuntu/composer.phar 我得到:Composer成功安装到:/home/ubuntu/composer.phar

sudo mv composer.phar /usr/local/bin/composer
composer

Works fine 工作正常

composer global require "laravel/installer"

I get: 我得到:

在此处输入图片说明

nano ~/.bashrc

I include this export PATH="~/.composer/vendor/bin:$PATH" at the very bottom. 我在export PATH="~/.composer/vendor/bin:$PATH"包括此export PATH="~/.composer/vendor/bin:$PATH"

sudo service apache2 restart

Restart it 重新启动

laravel

I get: "laravel: command not found" 我得到:“ laravel:找不到命令”

Why does it not understand the command laravel? 为什么不理解laravel命令?

I'm writing this answer for all the future Google searchers. 我正在为将来的所有Google搜索者编写此答案。 I had a similar issue and I solved it in the following way: 我遇到了类似的问题,并通过以下方式解决了该问题:

First run: 首轮:

sudo apt-get install zip unzip php7.0-zip

Then, edit your ~/.bashrc file and append the following line: 然后,编辑~/.bashrc文件并添加以下行:

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

or 要么

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

Which one is yours, depends on the line composer printed out during installation of laravel, followed by /vendor/bin . 哪个是您的,取决于laravel安装过程中输出的行编辑器,然后是/vendor/bin In my case (and in the case of the question), this was $HOME/.config/composer , so I had to do it the second way: 就我而言(就问题而言),这是$HOME/.config/composer ,所以我不得不用第二种方法: 在此处输入图片说明

Don't forget to call 别忘了打电话

source ~/.bashrc

at the end. 在末尾。 Enjoy Laravel! 享受Laravel!

From your screenshot, I can see that there may be a chance the laravel packages were not installed correctly as you don't have zip and unzip installed on your system. 从您的屏幕截图中,我可以看到laravel软件包可能没有正确安装,因为您的系统上没有安装zipunzip

Run the following command to install these first and then try again to install laravel installer: 运行以下命令,首先安装它们,然后重试安装laravel安装程序:

sudo apt-get install zip unzip

Regarding the export PATH use $HOME instead of the tilde ~ sign. 关于export PATH使用$HOME代替波浪号~ Hope this will solve your problem. 希望这能解决您的问题。 Seems like a path error. 好像是路径错误。

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

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

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