我的开发环境被消灭了,我在尝试修复它时遇到了一系列错误 [英] My development environment was wiped out and I'm getting a series of errors in trying to fix it
问题描述
所以我和我的一个朋友弄乱了 gemset,我不小心删除了一个.我不确定发生了什么,所以我只是把它刷掉了.
So I was messing with gemsets with a friend of mine and I accidentally deleted a one. I wasn't sure what happened, so I just kinda brushed it off.
然后我为我一直在开发的旧应用程序运行rails server",大约 2 分钟没有任何反应,最后它吐出一个错误.
Then I went to run 'rails server' for my old app that I've been working on and nothing happens for like 2 minutes and then finally it spits out an error.
/Users/Nick/.rvm/bin/ruby: line 6: /Users/Nick/.rvm/bin/ruby: Argument list too long
/Users/Nick/.rvm/bin/ruby: line 6: /Users/Nick/.rvm/bin/ruby: Undefined error: 0
然后我做了下面建议的所有事情,但我遇到了各种各样的错误.如果我要为每个错误创建一个单独的问题,我想我会把 stackoverflow 弄得一团糟,所以我想在这里给出某种解决方法.
So then I did everything suggested below and I've gotten all kinds of errors. If I were to create a seperate question for every error I think I'd be making a mess of stackoverflow, so I want to give some kind of order to solving this here.
现在我试图回溯并弄清楚发生了什么......每次我在答案中运行这些不同的命令时,我都在改变事情,而我不知道发生了什么.
Right now I'm trying to backtrack and figure out what happened... Every time I run these different commands in an answer I'm changing things while I have no idea what's going on.
当我尝试安装某个版本的 ruby 时,出现此错误:
When I try to install a version of ruby I get this error:
apple-gcc42 is not available in PATH, try:
brew unlink apple-gcc42 && brew link apple-gcc42
and make sure that apple-gcc42 is available in your PATH:
which gcc-4.2
我在某处读到安装 xCode 可以解决这个问题,所以我安装了它.虽然我得到了同样的错误.
I read somewhere that installing xCode would solve this, so I installed it. Although I get the same error.
当我尝试运行该错误的第一个建议时,我得到了这个:
When I try to run the first suggestions from that error I get this:
Unlinking /usr/local/Cellar/apple-gcc42/4.2.1-5666.3... 0 links removed
Linking /usr/local/Cellar/apple-gcc42/4.2.1-5666.3... Warning: Could not link apple-gcc42.
Unlinking...
Error: Could not symlink file: /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/include/gcc
/usr/local/include is not writable. You should change its permissions.
当我运行第二个建议时,它返回
When I run the second suggestions it returns
gcc-4.2 not found
<小时>
通常当我运行 'ruby -v' 或 'rails -v' 时,它会返回版本名称.现在它只返回与我运行 'rails s' 时完全相同的错误
Usually when I run 'ruby -v' or 'rails -v' it returns the version name. Now it just returns the exact same error as when I run 'rails s'
如果我尝试将 gemsets 从默认切换到全局,它会说
If I try to switch gemsets from default to global it says
To install do: 'rvm install ruby-1.9.3-p125'
但是如果我尝试安装它,我会遇到相同的 gcc 错误.
But then if I try to install it I get the same gcc error.
当我尝试安装 rails 时,出现关于安装 libyaml 的错误,我已经安装了 10 次:
When I try to install rails I get this error about installing libyaml, which I've installed like 10 times:
➜ app3 git:(add_food_servings) ✗ gem install rails
/Users/Nick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/Nick/.rvm/rubies/ruby-2.0.0-
p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require':
dlopen(/Users/Nick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin11.4.2/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
Referenced from: /Users/Nick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin11.4.2/psych.bundle
<小时>
我的问题是......发生了什么事,当我可以运行 rails 并安静地处理我的应用程序时,我怎样才能回到原来的状态!?哈哈
My question is... what's going on and how can I get back to where I was when I could run rails s and just work on my app in peace!? lol
推荐答案
你得到的错误:
/Users/Nick/.rvm/bin/ruby: line 6: /Users/Nick/.rvm/bin/ruby: Argument list too long /Users/Nick/.rvm/bin/ruby: line 6: /Users/Nick/.rvm/bin/ruby: Undefined error: 0
显示未使用 rvm ruby,请确保在工作前先使用 ruby:
shows that rvm ruby was not used, make sure you use ruby first before working:
rvm use ruby
如果你想使用为当前目录项目定义的ruby:
if you want to use ruby which is defined for current directory project use:
rvm use --install --create .
--install
和 --create
标志将处理丢失的 ruby 和 gemset.
the --install
and --create
flags will take care of missing ruby and gemset.
这篇关于我的开发环境被消灭了,我在尝试修复它时遇到了一系列错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!