无法在ubuntu上使用laravel框架创建项目

时间:2015-01-02 17:58:37

标签: ubuntu laravel composer-php

Laravel(ubuntu):在目录www / laravel中安装了作曲家后,我尝试用命令创建项目(composer create-project laravel / laravel project1 --prefer-dist)但是弹出错误

错误:没有命令'作曲家'发现,你的意思是:  命令'撰写'来自包装' mime-support' (主要) composer:命令未找到

2 个答案:

答案 0 :(得分:3)

安装composer的推荐方法是全局安装:

$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer

现在你可以运行:

$ composer

另一种方法是在本地安装它,不建议这样做。那意味着只执行

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

然后,你应该使用:

$ ./composer.phar
# or
$ php composer.phar

答案 1 :(得分:1)

Your composer is not accessible globally or not installed properly.

Use below command to install it globally so that you can run composer command everywhere.

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Notice the --filename=composer switch in the command it renames composer.phar to composer so that you can run $ composer instead of $ composer.phar

Complete guide about installing Laravel on Ubuntu can be found here: http://scriptbaker.com/install-laravel-on-ubuntu/