在 Ubuntu 上全局安装 Laravel/Lumen

Globally installing Laravel/Lumen on Ubuntu

我有一个 Amazon EC2 实例 Ubuntu 14.4.

我在全局安装了 composer

当我安装 Lumen 时,我得到了这个结果 - 一切似乎都很好:

ubuntu@ip-XXX-XX-XX-XX:/var/www/html$ composer global require "laravel/lumen-installer"
Changed current directory to /home/ubuntu/.config/composer
Using version ^1.0 for laravel/lumen-installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/process (v3.1.0)
    Loading from cache

  - Installing symfony/polyfill-mbstring (v1.2.0)
    Loading from cache

  - Installing symfony/console (v3.1.0)
    Loading from cache

  - Installing guzzlehttp/promises (1.2.0)
    Loading from cache

  - Installing psr/http-message (1.0)
    Loading from cache

  - Installing guzzlehttp/psr7 (1.3.0)
    Loading from cache

  - Installing guzzlehttp/guzzle (6.2.0)
    Loading from cache

  - Installing laravel/lumen-installer (v1.0.2)
    Loading from cache

symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing psr/log (For using the console logger)
Writing lock file
Generating autoload files
ubuntu@ip-XXX-XX-XX-XX:/var/www/html$

但是当我输入 lumenlumen new blog 时,我收到 lumen: command not found.

基于其他问题,我假设我必须将流明添加到 PATH 中,与此类似:

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

这没有什么区别- lumen: command not found在运行宁流门新博客后仍然显示

有人 运行 遇到过这个错误吗?

您的问题不会简单地通过取消设置 PATH 来解决,因为您仍然没有包含必要系统目录的 PATH。当您设置自己的 PATH 时,在大多数情况下,您会希望将新条目附加到旧 PATH 变量,而不是像您所做的那样完全替换它。

使用这个命令

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

注意变量设置为以现有的 $PATH 开头。这样,您的 PATH 中仍将拥有所有原始系统目录,并且您的添加将在最后。因为 lumen 显然是您要执行的二进制文件的名称,并且您的 PATH 应该只包含包含二进制文件的目录,而不是二进制文件本身。