Search code examples
laravellaravel-5.6behat

'-bash: behat: command not found' when Behat is installed


I have installed a clean version of Laravel 5.6. I have then installed Behat successfully with the output below.

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

But when I try to initialize Behat with

behat --init

I get the following error:

-bash: behat: command not found

What am I doing wrong? I had run composer self-update before this.


Solution

  • You are not installing behat globally either install it globally or use

    vendor/bin/behat --init
    

    If you want to install it globally then run

    composer global require behat/behat
    

    Hope this helps.