Reputation: 2763
I'm reading the book "Learn Rails" and when I try to config the mailer with my Gmail account. I finished chapter 12, and tried to start the server application:
$ rails server
I got this error:
/Users/romenig/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): mapping values are not allowed in this context at line 6 column 15 (Psych::SyntaxError)
from /Users/romenig/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /Users/romenig/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /Users/romenig/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:129:in `load'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/figaro-0.7.0/lib/figaro.rb:21:in `raw'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/figaro-0.7.0/lib/figaro.rb:17:in `env'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/figaro-0.7.0/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.1/lib/active_support/lazy_load_hooks.rb:36:in `call'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.1/lib/rails/application.rb:67:in `inherited'
from /Users/romenig/workspace_ror/learn-rails/config/application.rb:10:in `<module:LearnRails>'
from /Users/romenig/workspace_ror/learn-rails/config/application.rb:9:in `<top (required)>'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.1/lib/rails/commands.rb:74:in `require'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.1/lib/rails/commands.rb:74:in `block in <top (required)>'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.1/lib/rails/commands.rb:71:in `tap'
from /Users/romenig/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.1/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
What do I need to do?
I searching StackOverflow's similar questions and I they recommended installing "libyaml":
$ rvm pkg install libyaml
I got this message:
Beware, 'rvm pkg ...' is deprecated, read about the new autolibs feature: 'rvm help autolibs'.
Checking requirements for osx.
Updating certificates in '/opt/local/etc/openssl/cert.pem'.
romenig password required for 'mv -f /var/folders/y1/dgbv_pzd08bclqb3cnt_t0xw0000gn/T//tmp.ZRZBUpQ0BvThvcIhbV /opt/local/etc/openssl/cert.pem':
Requirements installation successful.
Fetching yaml-0.1.4.tar.gz to /Users/romenig/.rvm/archives
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
The requested url does not exist(22): 'https://rvm.io/src/yaml-0.1.4.tar.gz'
Checking fallback: ftp://rvm.io/src/yaml-0.1.4.tar.gz
Checking fallback: http://www.mirrorservice.org/sites/rvm.io/src/yaml-0.1.4.tar.gz
No fallback URL could be found, try increasing timeout with:
echo "export rvm_max_time_flag=20" >> ~/.rvmrc
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
I did:
$ rvm reinstall all --force
When I did this I saw many errors:
ruby-1.9.2-head - #compiling..............................................................................................
Error running '__rvm_make -j 1',
please read /Users/romenig/.rvm/log/1386193970_ruby-1.9.2-head/make.log
There has been an error while running make. Halting the installation.
Removing /Users/romenig/.rvm/src/ruby-2.0.0-p353
Removing /Users/romenig/.rvm/rubies/ruby-2.0.0-p353.................
Error running '__rvm_rm_rf /Users/romenig/.rvm/rubies/ruby-2.0.0-p353',
please read /Users/romenig/.rvm/log/1386194140_ruby-2.0.0-p353/remove.rubies.log
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-2.0.0-p353.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/opt/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/romenig/.rvm/rubies/ruby-2.0.0-p353, this may take a while depending on your cpu(s)...
ruby-2.0.0-p353 - #downloading ruby-2.0.0-p353, this may take a while depending on your connection...
ruby-2.0.0-p353 - #extracting ruby-2.0.0-p353 to /Users/romenig/.rvm/src/ruby-2.0.0-p353
ruby-2.0.0-p353 - #extracted to /Users/romenig/.rvm/src/ruby-2.0.0-p353
ruby-2.0.0-p353 - #configuring.......
.........
Error running '__rvm_rm_rf /Users/romenig/.rvm/rubies/ruby-2.0.0-p353',
please read /Users/romenig/.rvm/log/1386194140_ruby-2.0.0-p353/remove.rubies.log
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-2.0.0-p353.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/opt/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/romenig/.rvm/rubies/ruby-2.0.0-p353, this may take a while depending on your cpu(s)...
ruby-2.0.0-p353 - #downloading ruby-2.0.0-p353, this may take a while depending on your connection...
ruby-2.0.0-p353 - #extracting ruby-2.0.0-p353 to /Users/romenig/.rvm/src/ruby-2.0.0-p353
ruby-2.0.0-p353 - #extracted to /Users/romenig/.rvm/src/ruby-2.0.0-p353
ruby-2.0.0-p353 - #configuring.......
I tried to start the Rails server again:
$ rails server
And got:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
I installed Rails again and have the same error.
Upvotes: 1
Views: 677
Reputation: 11
The cause of the error for me was that the following line in application.yml was split in to two, and outside the commented scope-
#Each entry sets a local environment variable and overrides ENV variables in the Unix
shell.
Upvotes: 0
Reputation: 24468
First of all, reinstalling all of your Rubies nuked your installed gems; but those are easy enough to get back.
cd
into your project directory and run:
gem install bundler
bundle install
From the original error message:
mapping values are not allowed in this context at line 6 column 15 (Psych::SyntaxError)
It looks like there's a problem with the syntax in a YAML file. From the stack trace, it looks like it's coming from Figaro, so double-check your config/application.yml
file.
Upvotes: 2