我觉得自己是个白痴,不得不问这个问题,我已经问了所有类似的问题,但都没有用.我在mac上的一个流浪虚拟机上运行Ubuntu14.04.我安装了composer,并运行了以下命令:

composer global require "laravel/installer"

(这似乎起到了作用,表明laravel是下载的东西之一)

I have also added this line to the .bashrc

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

Note, i added this to both the vagrant user as well as the root users .bashrc file. I have logged out and back into the shell and verified the path with this command:

echo $PATH

这让我想到:

∼/.编写者/供应商/bin:∼/.composer /vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

and the command itself that fails is this

laravel new test

我看不出我会错过什么,有什么 idea 吗?

推荐答案

It is better to use $HOME instead of just ~.

In my .zshrc(I use zsh) I have it working this way

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

确保你的终端确实使用了.bashrc而不是.bash_profile,如果是这样的话,你应该编辑这个文件.

此外,请记住在编辑后创建文件源文件,或者打开一个新的终端.

UPDATE

我知道有些答案把$PATH放在composer 的路径之后,所以我想我可以告诉你我学到了什么,这就是区别.

这不是一件你可以随心所欲地随心所欲的事情.What you put after overwrites what comes before.如果您想要使用覆盖已在PATH中的路径中安装的任何内容的包,则需要知道这一点.

That means that if you have something installed on your system and you install a newer version of the package using composer, it will have the same command to start so if the composer path will not be after the system path, you'll have to reference the full path to the binary inside composer's vendor/bin to execute it.

Laravel相关问答推荐

Nuxt 3获取多部分表单数据上传不起作用

在Laravel Livewire中,如果一个输入基于另一个唯一的字段是唯一的,如何判断验证?

如何使用 Laravel 进行继承

Laravel:在 PHPUnit 的覆盖率报告中包含文件夹(如果在 app/ 文件夹之外)?

如何使用 laravel 更新单个值

spatie 包 laravel-tags 在迁移中没有 down() 函数是有原因的吗

如何在 Laravel Eloquent Collection 数组之前添加一个键值对?

找不到 Laravel 5 类日志(log)

Laravel/Eloquent:致命错误:在非对象上调用成员函数 connection()

Laravel 5.4 - 如何为同一个自定义验证规则使用多个错误消息

判断 Laravel 中是否存在唯一索引键

Laravel 中的 index()" 是什么意思?

Laravel 5.4 中的自定义助手类

如何更改 ember-cli 中的 dist 文件夹路径?

Laravel 4 - 如何将所有字段的所有验证错误消息作为 JSON struct 返回?

如何运行artisan命令计划:在托管服务器上运行? (Laravel )

Laravel 如何具体构建和判断 CSRF 令牌?

我在哪里放置可以显示 Flash 消息的 Laravel 4 辅助函数?

带有 Xdebug 的 Laravel 5 总是抛出The payload is invalid..

你如何在 Laravel 5.3 的新通知服务生成的Electron邮件中添加图像?