I am trying to install composer on my Mac so that I can use the Laravel framework. I successfully downloaded composer through the terminal, and then I moved composer.phar to to usr/local/bin using the command: sudo mv composer.phar /usr/local/bin.

I then changed directories to my root directory where I have the laravel-master files. After changing to this directory in the terminal, and then using the command: composer install

I receive the error: -bash: composer: command not found

我try 过其他的变体(比如php composer.phar install等等),然而,我一直收到同样的错误.

Any help would be much appreciated. Thank you!

推荐答案

确保你的$PATH里有/usr/local/bin

$ echo $PATH

然后执行

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
                                       ^^^^^^^^ you didn't rename it 

有关参考信息,请参阅

Laravel相关问答推荐

在Vite list 中找不到文件:Resources/scss/hrms.scss.如何使用LARAVEL VITE解决这个问题?

LARAVEL 从多个表中获取重复的行

如何获取多态多对多关系子查询的自动 id 列名?

如何在 laravel 中为另一个用户 session()->forget('cart')?

不能在 laravel 中使用控制器名称,必须使用命名空间

如何在生产中的 laravel 应用程序中获取标头请求值?

FileViewFinder.php 第 137 行中的 Laravel 5 InvalidArgumentException:未找到视图 [.admin]

如何使用 Laravel Passport 在 API 中正确实现 OAuth?

.gitignore 不忽略文件夹

Laravel Session 总是改变 Laravel 5.4 中的每个刷新/请求

Laravel 5.5 在迁移文件中设置整数字段的大小

从 sqlite DB 登录 Laravel,得到PDOException 找不到驱动程序

Laravel 5 - 在控制器文件中为多个路由定义中间件

CRON 作业(job) - LARAVEL - 输出

laravel 4 - 如何限制(采取和跳过)Eloquent的 ORM?

Blade 中的条件扩展

Laravel 隐藏属性.例如密码 - 安全

Laravel 数据库模式中的 MediumBlob

复合唯一密钥验证 - laravel

laravel - 无法在控制器构造函数中获取会话