-bash被搞砸? [英] -bash is messed up?

查看:312
本文介绍了-bash被搞砸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图弄清楚为什么我不能设置Heroku的宝石并按照这个答案的 SO 2396004(Heroku的宝石不工作)。我想我可能会搞砸我的系统。

现在我打字Heroku的名单,我得到(-bash:Heroku的:找不到命令),当我在红宝石型-v我得到(-bash:红宝石:找不到命令)

下面是最新的输出

  ZAK $出口PATH = $ PATHEXECUTABLE目录:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin
-bash:出口:`目录::无效的标识符
-bash:出口:`/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin:无效的标识符ZKidds-的MacBook-PRO:rails_projects扎克出口$ PATH = $ PATH:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/binZKidds-的MacBook-PRO:rails_projects ZAK $ Heroku的列表
-bash:Heroku的:命令未找到ZKidds-的MacBook-PRO:rails_projects扎克$ CD ..ZKidds-的MacBook-Pro的:〜$ ZAK出口PATH = $ PATH:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/binZKidds-的MacBook-Pro的:〜$ ZAK名单的Heroku
-bash:Heroku的:命令未找到ZKidds-的MacBook-Pro的:〜$ ZAK回声$ PATH
:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin
-bash:创业板:命令未找到ZKidds-的MacBook-Pro的:〜$ ZAK宝石ENV
-bash:宝石:命令未找到ZKidds-的MacBook-Pro的:〜$ ZAK名单heroko
-bash:heroko:命令未找到


解决方案

当您设置PATH只是一个值,你失去了所有的其他地方进行搜索,如 / bin中的/ usr / bin中。逐步设置PATH:

 出口PATH = /新/地点/斌:$ PATH

您可以比更精细,但是基本技术的工作原理。

与此同时,注销并重新登录 - 这将让你去最容易。或者:

 出口PATH = $ PATH:/ bin中:在/ usr / bin中


此外,你的第一行是:

 出口PATH = $ PATHEXECUTABLE目录:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin

当您运行导出,则将导出一个或多个变量,但值必须是简单的变量名,或者必须是变量赋值:

 出口SOMEVAR NOTHERVAR =新的价值...

投诉 -bash:出口:目录:':不是一个有效的identifier`是告诉你,目录:是无效的。目前尚不清楚你脑子里的东西。和你有大约/一个类似的投诉用户/ ZAK / ...不是一个标识符。

您可以设置环境变量只是一个命令的运行:

  PATH = $ EXECUTABLE_DIRECTORY:$ PATH /用户/ ZAK /斌/命令

该命令的环境将包括指定路径的价值;但是请注意,在shell不会搜索与修改的路径命令。



  

...什么我试图做的是...


我不Ruby或Rails的的用户,但在我的Mac(10.6.4),我能找到的:

 奥西里斯-2 JL:红宝石-v
红宝石1.8.7(2009-06-12补丁级别174)万向darwin10.0]
奥西里斯-2 JL:轨-v
2.3.5的Rails
奥西里斯-2 JL:这红宝石轨
在/ usr /斌/红宝石
在/ usr /斌/导轨
奥西里斯-2 JL:

所以,我的机器上,Ruby和Rails的是的/ usr / bin中。我没有Heroku的安装AFAIK(而不是在我的道路,反正)。你的第一个出口重挫PATH;第二个加入你的Ruby 1.9.2目录到空路径。显然,Heroku的安装在其他地方,或尚未安装的。你改变目录 - 一个内置的操作,不需要工作路径;您再次添加了Ruby 1.9.2目录到PATH(没有​​有效改变任何东西)。 Heroku上仍然没有找到。您回应PATH(另一个内置) - 我不清​​楚其中 GEM:找不到命令消息从何而来。而命令宝石 heroko (原文如此)都没有发现。所以,你的第一个命令在列车上的问题设置。

然后你说:


  

在什么,我试图做的方面,我只是想建立我的Heroku的帐户,当我试图加我的SSH公钥卡住了。我已经安装了heroko宝石(思想)没有注册。这时候,我通过引用上面,暗示我的道路是不正确的计算器问题读取。我关闭终端并重新打开。运行的东西,如红宝石-v输出,但运行轨道-v没有。有什么还是做什么?为什么轨道-v不输出?


  
  

特别是在轨道上-v我得到/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in report_activate_error':找不到RubyGem导轨(大于= 0)(宝石:: LoadError)从/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:inactivate'从/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in'宝石'从/ usr / bin中/导轨:18


这意味着你必须安装在/ usr / bin中(像我一样)轨,但安装已经以某种方式改变因此它是自我不一致。或许到那时搞砸环境(PATH)在作祟。但通常,软件可以找到自己的bits'n'pieces,所以建议有东西了。麻烦的部分可能是你使用一个Ruby 1.9.2计划与一些红宝石1.8软件。

我个人的政策是严格独自离开O / S提供的软件;我让Mac更新采取照顾。如果我想我自己的东西的版本,我建立它和我的控制之下进行安装 - 我这样做是用Perl,有时与海湾合作委员会,并使用Gi​​t或SVN或水银或其他类似的软件

我想看看以确保您对Ruby 1.9.2的环境中全面合作,并担心你是否需要更新您的并行Rails环境。我怀疑是使用Ruby 1.9.2与Ruby的1.8.x的内置Rails的会引起一些麻烦 - 但我不能肯定那

Trying to figure out why I could not set up Heroku Gem and following this answer SO 2396004 (Heroku Gem Doesn't Work). I think I might have messed up my system.

Now I am typing heroku list and I get (-bash: heroku: command not found) and when I type in ruby -v I get (-bash: ruby: command not found)

BELOW IS THE MOST RECENT OUTPUT

zak$ export PATH=$PATHEXECUTABLE DIRECTORY: /Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin
-bash: export: `DIRECTORY:': not a valid identifier
-bash: export: `/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin': not a valid identifier

ZKidds-MacBook-Pro:rails_projects zak$ export PATH=$PATH:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin

ZKidds-MacBook-Pro:rails_projects zak$ heroku list
-bash: heroku: command not found

ZKidds-MacBook-Pro:rails_projects zak$ cd ..

ZKidds-MacBook-Pro:~ zak$ export PATH=$PATH:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin

ZKidds-MacBook-Pro:~ zak$ heroku list
-bash: heroku: command not found

ZKidds-MacBook-Pro:~ zak$ echo $PATH
:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin:/Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin
-bash: GEM: command not found

ZKidds-MacBook-Pro:~ zak$ gem env
-bash: gem: command not found

ZKidds-MacBook-Pro:~ zak$ heroko list
-bash: heroko: command not found

解决方案

When you set PATH to just one value, you lost all the other places to search, such as /bin and /usr/bin. Set your PATH incrementally:

export PATH=/new/place/bin:$PATH

You can be more elaborate than that, but that basic technique works.

Meantime, logout and login again - that will get you going most easily. Alternatively:

export PATH=$PATH:/bin:/usr/bin


Additionally, your first line was:

export PATH=$PATHEXECUTABLE DIRECTORY: /Users/zak/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin

When you run export, it will export one or more variables, but the values must either be simple variable names, or must be variable assignments:

export SOMEVAR NOTHERVAR=new-value ...

The complaint -bash: export:DIRECTORY:': not a valid identifier` is telling you that 'DIRECTORY:' is not valid. It is not clear what you had in mind. And you got a similar complaint about /Users/zak/... not being an identifier.

You can set an environment variable for just one run of a command:

PATH=$EXECUTABLE_DIRECTORY:$PATH /Users/zak/bin/command

The environment of the command will include the value of PATH given; note, though, that the shell won't search for the command with that modified path.


...What I was trying to do was...

I'm not a user of either Ruby or Rails, but on my Mac (10.6.4), I can find:

Osiris-2 JL:  ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
Osiris-2 JL: rails -v
Rails 2.3.5
Osiris-2 JL: which ruby rails
/usr/bin/ruby
/usr/bin/rails
Osiris-2 JL: 

So, on my machine, both Ruby and Rails are in /usr/bin. I don't have Heroku installed AFAIK (not on my PATH, anyway). Your first export clobbered PATH; the second one added your Ruby 1.9.2 directory to the empty PATH. Apparently, Heroku is installed somewhere else, or is not yet installed at all. You changed directory - a built-in operation that does not require a working PATH; you added the Ruby 1.9.2 directory to your PATH again (which didn't change anything usefully). Heroku is still not found. You echoed PATH (another built-in) - I'm not clear where the GEM: command not found message comes from. And the commands gem and heroko (sic) were not found. So, your first command set in train the problems.

Then you commented:

In terms of what I was trying to do, I was just trying to set-up my heroku account and got stuck when I tried to add my public ssh key. The heroko gem I had installed (thought) was not registering. That is when I read through the stackoverflow question referenced above that suggested my path was incorrect. I closed terminal and reopened. Running stuff like ruby -v outputs, but running rails -v does not. Is there something still to do? Why would rails -v not output?

Specifically on rails -v I get "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:inactivate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem' from /usr/bin/rails:18 "

This suggests that you have rails installed in /usr/bin (like I do), but the installation has been altered somehow so it is self-inconsistent. Either that or the messed up environment (PATH) is causing trouble. But usually, software can find its own bits'n'pieces, so it suggests there is something up. Part of the trouble may be that you're using a Ruby 1.9.2 program with some Ruby 1.8 software.

My personal policy is to leave o/s provided software strictly alone; I let the Mac updates take care of that. If I want my own version of something, I build it and install it under my control - I do this with Perl, sometimes with GCC, and with Git or SVN or Mercurial or other such software.

I would look at ensuring you have the Ruby 1.9.2 environment working fully, and worry about whether you need to update your Rails environment in parallel. I suspect that using Ruby 1.9.2 with Rails built for Ruby 1.8.x is causing some of the trouble - but I'm not certain of that.

这篇关于-bash被搞砸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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