I'm trying to configure behat and seeing an error - failed to open stream: No such file or directory in /usr/bin/behat

∥☆過路亽.° 提交于 2019-12-11 01:36:29

问题


PHP Warning: require_once(behat/autoload.php): failed to open stream: No such file or directory in /usr/bin/behat on line 23 PHP Fatal error: require_once(): Failed opening required 'behat/autoload.php' (include_path='.:/usr/bin/pear:/usr/lib/php:/Users/steve/perforce/') in /usr/bin/behat on line 23

Any ideas what might be causing this??


回答1:


do you have the file at one of the following places :/usr/bin/pear/behat/autoload.php OR :/usr/lib/php/behat/autoload.php: OR /Users/steve/perforce/behat/autoload.php

I am sure it is not there. if it is some where else like BASE_PATH.'my_folder' add this path to include paths like this

set_include_path(BASE_PATH.'my_folder',get_include_path());



回答2:


This is probably due to a broken installation. I would suggest you install behat with composer, if you want it globally installed then run

$ composer global require behat/behat

Then make sure you add the composer path to your $PATH variable.

Its much easier to work with behat as a local dependency of your project. I am not sure if you are using it for a PHP project but if you are then i'd recommend not to install it globally, instead in your composer.json file add it as a dev dependency:

{
  "require-dev": {
    "behat/behat": "~3.0"
  }
}

Then run composer update to get it installed locally. You can then access it by running vendor/bin/behat.

From personal experience, installing behat globally can give you issues because of other local libraries you may need per project basis. This may have been resolved now but I had issues when one local project behat dependency differed from another projects.



来源:https://stackoverflow.com/questions/10832761/im-trying-to-configure-behat-and-seeing-an-error-failed-to-open-stream-no-su

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!