-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: 错误的解释器: 没有那个文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7907055/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory
提问by Kyle Decot
Whenever I open a new terminal window I now get:
每当我打开一个新的终端窗口时,我都会得到:
-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory
-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory
Any idea as to why this is happening and how to get rid of it?
关于为什么会发生这种情况以及如何摆脱它的任何想法?
回答by chown
Make sure the first line of the file /usr/local/bin/herokuis #!/path/to/ruby. You may need to change it from /usr/local/bin/rubyto /usr/bin/ruby, or if you cannot find the rubyexecutable, type which rubyor updatedb && locate rubyto find it.
确保文件的第一行/usr/local/bin/heroku是#!/path/to/ruby. 您可能需要将其从 更改/usr/local/bin/ruby为/usr/bin/ruby,或者如果您找不到ruby可执行文件,请键入which ruby或updatedb && locate ruby以找到它。
If the above doesn't work...
如果以上方法不起作用...
Check your ~/.bashrc, ~/.inputrc~, /etc/bashrc, /etc/inputrc, /etc/profilefor a line trying to execute /usr/local/bin/heroku.
检查~/.bashrc,~/.inputrc~,/etc/bashrc,/etc/inputrc,/etc/profile用于线路试图执行/usr/local/bin/heroku。
Another idea is you might have this as one of your startup programs. Check in /etc/inittabfor a line with /usr/local/bin/heroku.
另一个想法是您可以将其作为启动程序之一。签入/etc/inittab一行/usr/local/bin/heroku。
If you still cannot find that line in any of those files you can run grep -iH heroku /*
如果您仍然无法在任何这些文件中找到该行,则可以运行 grep -iH heroku /*
回答by Bruno
brew install wget
wget -qO- https://toolbelt.heroku.com/install.sh | sh
回答by shenlu
-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory
-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory
You should firstly read the massage that the terminal throw out. /usr/local/bin/ruby: bad interpreter: No such file or directorythat means there is no valid rubycommand in the /usr/local/bin. So if you have install rubybut in another directory. You can use ln -sto link the /usr/local/bin/directory. So find it out, such as /usr/bin/ruby. You can get into/usr/local/bin/directory run ln -s /usr/bin/ruby. If you have not started installing ruby, you should install it and make sure the rubycommand in the /usr/local/bindirectory
您应该首先阅读终端抛出的按摩。/usr/local/bin/ruby: bad interpreter: No such file or directory这意味着没有有效ruby的命令/usr/local/bin。所以如果你有安装ruby但在另一个目录中。您可以使用ln -s链接/usr/local/bin/目录。所以找出来,例如/usr/bin/ruby。您可以进入/usr/local/bin/目录 run ln -s /usr/bin/ruby。如果你还没有开始安装ruby,你应该安装它并确保目录中的ruby命令/usr/local/bin
回答by Cleverlemming
I had a similar problem which resulted in the following error message when I tried to run any heroku commands:
当我尝试运行任何 heroku 命令时,我遇到了类似的问题,导致以下错误消息:
(~/).gem/ruby/1.8/bin/heroku: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
After some searching, I found a copy of the heroku-api gem in ~/.gem/ruby/1.8/cache. Deleting it and deleting the rubygems reference file in ~/.gem/ruby/1.8/bin solved the problem.
经过一番搜索,我在 ~/.gem/ruby/1.8/cache 中找到了 heroku-api gem 的副本。删除它并删除 ~/.gem/ruby/1.8/bin 中的 rubygems 参考文件解决了问题。
回答by Tim
I was running "pod init" in a directory. This gave me a similar error:
我在一个目录中运行“pod init”。这给了我一个类似的错误:
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
Solution: install Cocoapods following the directions on their website.
解决方案:按照其网站上的说明安装 Cocoapods。
回答by uzsolt
How did you install heroku? If from source, you should recompile with proper directories.
你是如何安装heroku的?如果来自源代码,您应该使用正确的目录重新编译。
You can edit /usr/local/bin/herokubut I think better when you recompile it (who knows where are more bad settings in heroku).
你可以编辑,/usr/local/bin/heroku但我认为当你重新编译它时会更好(谁知道 heroku 中哪里有更糟糕的设置)。

