〜/ ruby​​-2.1.1 / lib / ruby​​ / 2.1.0 / psych.rb:370:在`parse':( <unknown>):映射值是......第3行第8列(Psych :: SyntaxError) </未知>

时间:2014-03-22 22:05:27

标签: ruby-on-rails psych

我是Rails的新手。在Linux上使用RoR 16。 捆绑安装似乎给我一些问题。生成此错误的命令列表: gem install bundlerbundle install --without productionbundle updategem install pg或任何gem install <insert_gem_here>(下方删除的超链接)

judeman@VB ~/rails_projects/first_app $ bundle update
Fetching gem metadata from ://rubygems.org/....
Fetching additional metadata from ://rubygems.org/..
**Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at**
://bit.ly/bundler-issues. Thanks!
/home/judeman/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/psych.rb:370:in `parse': (<unknown>): mapping values are not allowed in this context at line 3 column 8 (Psych::SyntaxError)
    from /home/judeman/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/psych.rb:370:in `parse_stream'
    from /home/judeman/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/psych.rb:318:in `parse'
    from /home/judeman/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/psych.rb:245:in `load'
    from /home/judeman/.rvm/rubies/ruby-2.1.1/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:333:in `load_file'
    from /home/judeman/.rvm/rubies/ruby-2.1.1/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:198:in `initialize'
    from /home/judeman/.rvm/rubies/ruby-2.1.1/lib/ruby/site_ruby/2.1.0/rubygems.rb:289:in `new'
    from /home/judeman/.rvm/rubies/ruby-2.1.1/lib/ruby/site_ruby/2.1.0/rubygems.rb:289:in `configuration'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/rubygems_integration.rb:48:in `configuration'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/rubygems_integration.rb:71:in `sources='
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/source/rubygems.rb:275:in `remote_specs'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/source/rubygems.rb:166:in `fetch_specs'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/source/rubygems.rb:66:in `specs'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/definition.rb:216:in `block (2 levels) in index'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/definition.rb:213:in `each'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/definition.rb:213:in `block in index'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/index.rb:9:in `build'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/definition.rb:209:in `index'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/definition.rb:203:in `resolve'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/definition.rb:133:in `specs'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/definition.rb:122:in `resolve_remotely!'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/installer.rb:82:in `run'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/installer.rb:15:in `install'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/cli.rb:334:in `update'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/command.rb:27:in `run'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/base.rb:440:in `start'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/cli.rb:10:in `start'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/bin/bundle:20:in `block in <top (required)>'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/bin/bundle:20:in `<top (required)>'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/bin/bundle:23:in `load'
    from /home/judeman/.rvm/gems/ruby-2.1.1@global/bin/bundle:23:in `<main>'
    from /home/judeman/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
    from /home/judeman/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'

[错误的宝石文件]

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.4'

# Use sqlite3 as the database for Active Record
group :development do
    gem 'sqlite3'
end

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.2'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'


gem 'turbolinks'

gem 'jbuilder', '~> 1.2'

group :production do
    gem 'pg'
    gem 'rails_12factor'
end

ruby '2.1.1'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

1 个答案:

答案 0 :(得分:0)

调用Psych可能是因为在您的项目中使用环境变量或YAML文件,其中一个文件存在语法错误。

检查这些文件:

~/.bashrc 
~/.profile
~/.bash_profile

config/dababase.yml

如果其中一个语法中有语法错误,则表示正在捕获输出。我有类似的问题并修复了~/.profile错误,一切都很好!