繁体   English   中英

-bash:rspec:找不到命令

[英]-bash: rspec: command not found

我在/Library/Ruby/Gems/1.8/gems/rspec-2.6.0/lib中找到了rspec,我什至在我的.bash_profile中放置了它的路径:PATH =“ / usr / local / bin:/ Library / Ruby / Gems /1.8/gems/rspec-2.6.0/lib:

但是当我在终端输入rspec时,找不到命令。 即使我和文件rspec在同一个目录中?

除了成为菜鸟以外,我在做什么错?

* 更新: *我能够使用“ bundle exec rspec”执行rspec,但是我想弄清楚为什么我不能只使用rspec。

检查您的PATH环境变量是否符合您的期望。 echo $PATH
检查您的目标二进制文件具有可执行权限。 ls -l /Library/Ruby/Gems/1.8/gems/rspec-2.6.0/lib
再检查一遍。 which rspec

为了使文件可以二进制执行,通常需要:

(a) make the file executable by running chmod 755 /path/to/scripts/awesometask.gem 
(b) add a "shebang" to the top of the file (first line) that contains the path of the interpreter for the script: #!/usr/bin/ruby 
(c) execute file with full path: /path/to/scripts/awesometask.gem 
or
(c1) add the folder where the file is to PATH: PATH=$PATH:/path/to/scripts

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM