首页 > 解决方案 > 安装 Behat 时出现“-bash: behat: command not found”

问题描述

我已经安装了 Laravel 5.6 的干净版本。然后我已经成功安装了 Behat,输出如下。

composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension --dev
Using version ^3.4 for behat/behat
Using version ^1.7 for behat/mink
Using version ^2.3 for behat/mink-extension
Using version ^1.1 for laracasts/behat-laravel-extension
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 15 installs, 0 updates, 0 removals
  - Installing symfony/dom-crawler (v4.1.2): Downloading (100%)         
  - Installing behat/mink (dev-master d5ee350): Cloning d5ee350c40
  - Installing symfony/browser-kit (v4.1.2): Downloading (100%)         
  - Installing behat/mink-browserkit-driver (1.3.3): Downloading (100%)         
  - Installing symfony/yaml (v4.1.2): Downloading (100%)         
  - Installing symfony/dependency-injection (v4.1.2): Downloading (100%)         
  - Installing symfony/filesystem (v4.1.2): Downloading (100%)         
  - Installing symfony/config (v4.1.2): Downloading (100%)         
  - Installing symfony/class-loader (v3.4.13): Downloading (100%)         
  - Installing container-interop/container-interop (1.2.0): Downloading (100%)         
  - Installing behat/transliterator (v1.2.0): Downloading (100%)         
  - Installing behat/gherkin (v4.5.1): Downloading (100%)         
  - Installing behat/behat (v3.4.3): Downloading (100%)         
  - Installing laracasts/behat-laravel-extension (1.1.1): Downloading (100%)         
  - Installing behat/mink-extension (2.3.1): Downloading (100%)         
behat/mink suggests installing behat/mink-goutte-driver (fast headless driver for any app without JS emulation)
behat/mink suggests installing behat/mink-selenium2-driver (slow, but JS-enabled driver for any app (requires Selenium2))
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
behat/mink suggests installing dmore/chrome-mink-driver (fast and JS-enabled driver for any app (requires chromium or google chrome))
symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
symfony/class-loader suggests installing symfony/polyfill-apcu (For using ApcClassLoader on HHVM)
behat/behat suggests installing behat/symfony2-extension (for integration with Symfony2 web framework)
behat/behat suggests installing behat/yii-extension (for integration with Yii web framework)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nunomaduro/collision
Package manifest generated successfully

但是当我尝试用

behat --init

我收到以下错误:

-bash: behat: command not found

我究竟做错了什么?在此之前我已经运行了 composer self-update 。

标签: laravellaravel-5.6behat

解决方案


您没有全局安装 behat 全局安装或使用

vendor/bin/behat --init

如果要全局安装,请运行

composer global require behat/behat

希望这可以帮助。


推荐阅读