Ruby on rails rails 4:在第2行第11列的上下文中不允许映射值(Psych::SyntaxError)?
我已经成功安装了rails 4,并使用rails 4.0.0创建了项目Ruby on rails rails 4:在第2行第11列的上下文中不允许映射值(Psych::SyntaxError)?,ruby-on-rails,devise,rubygems,gem,ruby-on-rails-4,Ruby On Rails,Devise,Rubygems,Gem,Ruby On Rails 4,我已经成功安装了rails 4,并使用rails 4.0.0创建了项目 rails s 这是我第一次工作得很好。但在gemfile中添加“Desive”gem之后 gem 'devise', '~> 3.0.0.rc' 在运行bundle安装时,出现以下错误。这个错误的原因是什么?解决方法是什么 我也尝试过对gem'devise'部分进行注释,但现在每个rails命令都出现了相同的错误 /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.
rails s
这是我第一次工作得很好。但在gemfile中添加“Desive”gem之后
gem 'devise', '~> 3.0.0.rc'
在运行bundle安装时,出现以下错误。这个错误的原因是什么?解决方法是什么
我也尝试过对gem'devise'部分进行注释,但现在每个rails命令都出现了相同的错误
/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): mapping values are not allowed in this context at line 2 column 11 (Psych::SyntaxError)
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:129:in `load'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/config_file.rb:318:in `load_file'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/config_file.rb:191:in `initialize'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `new'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `do_configuration'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/gem_runner.rb:46:in `run'
gem'Desive'与任何版本,在捆绑包上显示以下错误,如果我删除Desive gem,它工作正常,我使用了rails 3.2.13,但我从未遇到过这样的问题,多么奇怪
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): mapping values are not allowed in this context at line 2 column 11 (Psych::SyntaxError)
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:129:in `load'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:318:in `load_file'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:191:in `initialize'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems.rb:319:in `new'
from /home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems.rb:319:in `configuration'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:34:in `configuration'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:53:in `sources='
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:250:in `remote_specs'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in `fetch_specs'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in `specs'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in `block (2 levels) in index'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `each'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `block in index'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in `build'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in `index'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:in `resolve_remotely!'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in `run'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle:23:in `load'
from /home/siv/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle:23:in `<main>'
from /home/siv/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
from /home/siv/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
从中获取gem元数据https://rubygems.org/.........
从中获取gem元数据https://rubygems.org/..
不幸的是,发生了一个致命错误。请参阅捆绑机故障排除文档,网址为http://bit.ly/bundler-issues. 谢谢
/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:在'parse'中:():在第2行第11列不允许映射值(psych::SyntaxError)
from/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in'parse_stream'
from/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:153:in'parse'
from/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:129:in'load'
from/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site\u ruby/2.0.0/rubygems/config\u file.rb:318:in'load\u file'
from/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site\u ruby/2.0.0/rubygems/config\u file.rb:191:在“初始化”中
from/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site\u ruby/2.0.0/rubygems.rb:319:in'new'
from/home/siv/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site\u ruby/2.0.0/rubygems.rb:319:在“配置”中
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:34:in'configuration'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/rubygems_-integration.rb:53:in`sources='10〕
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:250:in'remote_specs'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in'fetch_specs'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in'specs'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in`block(2层)in index'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in'each'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:在“索引中的块”中
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in'build'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in'index'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in'resolve'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in'specs'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:“远程解析!”
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in'run'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in'install'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in'install'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in'run'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in'invoke_task'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in'dispatch'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in'start'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:20:in'block in'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in'with_-friendly_errors'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:20:in`'
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/箱/捆:23:在“装载”中
from/home/siv/.rvm/gems/ruby-2.0.0-p247@global/箱子/包裹:23:in`'
from/home/siv/.rvm/gems/ruby-2.0.0-p247/bin/ruby\u noexec\u包装:14:in'eval'
from/home/siv/.rvm/gems/ruby-2.0.0-p247/bin/ruby\u noexec\u包装:14:in`'
如果有人仍然出现同样的错误,您可以检查项目中的YAML文件。在本例中,问题是数据库.yml中缺少缩进。应该是这样的:
development:
adapter: mysql2
encoding: utf8
database: realstate_development
pool: 5
username: root
password: root
socket: /var/run/mysqld/mysqld.sock
我得到了相同的错误,但有其他原因,而整个问题是在不正确的应用程序中。yml首先注意,yml文件中的解析方法由于Psych::SyntaxError而失败。然后在文件中查找以下内容
YAML文件应该正确缩进,并且必须遵循正确的语法
1.列表的所有成员都是以“-”(破折号和空格)开头的同一缩进级别的行:
2.字典以简单的key:value形式表示(冒号后面必须跟空格):
有关更多与语法相关的信息,请查看以下链接:是否可以同时发布您的database.yml文件?人们通常通过编辑发布其他文件bundle安装也会引发相同的错误,错误消息如下:不幸的是,发生了致命错误。请参阅位于的捆绑机故障排除文档。谢谢我照做了,但没有解决办法。问题出在o
development:
adapter: mysql2
encoding: utf8
database: realstate_development
pool: 5
username: root
password: root
socket: /var/run/mysqld/mysqld.sock