我正在尝试配置behat并看到错误-无法打开流:/usr/bin/behat中没有这样的文件或目录 [英] I'm trying to configure behat and seeing an error - failed to open stream: No such file or directory in /usr/bin/behat

查看:103
本文介绍了我正在尝试配置behat并看到错误-无法打开流:/usr/bin/behat中没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP警告:require_once(behat/autoload.php):无法打开流:/usr/bin/behat上第23行没有此类文件或目录 PHP致命错误:require_once():无法在/usr中打开所需的'behat/autoload.php'(include_path ='.:/usr/bin/pear:/usr/lib/php:/Users/steve/perforce/')/bin/behat 23行

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??

推荐答案

这可能是由于安装损坏导致的.我建议您使用composer安装behat,如果要全局安装它,请运行

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

然后确保将作曲器路径添加到$PATH变量.

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

使用behat作为项目的本地依赖项要容易得多.我不确定您是否将其用于PHP项目,但是如果不这样做,建议您不要全局安装,而是在composer.json文件中将其添加为dev依赖项:

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"
  }
}

然后运行composer update使其在本地安装.然后,您可以通过运行vendor/bin/behat来访问它.

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

根据个人经验,由于每个项目可能需要其他本地库,因此在全球范围内安装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.

这篇关于我正在尝试配置behat并看到错误-无法打开流:/usr/bin/behat中没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆