无法执行任何rails或rake命令

时间:2013-03-18 22:44:04

标签: ruby-on-rails-3

当我尝试执行任何命令时, 例如rake secretrails server

我收到以下错误,rake被中止:

  

方法YAML.enable_arbitrary_object_deserialization!已弃用,将在下一版SafeYAML中删除 - 将SafeYAML::OPTIONS[:default_mode]设置为:safe:unsafe

请指教。 (我是Ruby on Rails的新手)。

2 个答案:

答案 0 :(得分:1)

执行以下操作:

1- Go to the root of your application.
2- From there, go to the `config` folder and open the `environment.rb`
3- Put `SafeYAML::OPTIONS[:deserialize_symbols] = true`
4- Try again.

这是Safe_Yaml gem中列出的已知问题:https://github.com/dtao/safe_yaml(参见已知问题部分)

答案 1 :(得分:0)

原来我使用的是错误版本的ruby,我的rvm坏了。 另外,我的.rvmrc文件没有正确执行。

  1. 我按照说明进行操作 Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v 并重建我的RVM

  2. 然后将rvm与我的shell集成: https://rvm.io/integration/gnome-terminal/

  3. 为我的项目安装了正确版本的ruby: rvm install ruby​​-1.9.3-p374

  4. 我仍然收到'YAML.enable ...'警告,但命令现在执行。