Installing ruby 2.1 and rails 4.2 in centos 7

930 views
Skip to first unread message

Nanduchocom

unread,
Jan 18, 2015, 12:54:46 PM1/18/15
to rubyonra...@googlegroups.com
I install ruby 2.1 and rails 4.2 in centos 7,

But, when i try init:  
rails s
Appear this messsages:

/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `require': cannot load such file -- rails/app_rails_loader (LoadError)
        from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
        from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in `require'
        from /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.8/lib/rails/cli.rb:1:in `<top (required)>'
        from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
        from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
        from /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.8/bin/rails:9:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.1.2/bin/rails:23:in `load'
        from /usr/local/rvm/gems/ruby-2.1.2/bin/rails:23:in `<main>'
        from /usr/local/rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
        from /usr/local/rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'

I need help, i don't find more information in Centos or Ruby sites.

Colin Law

unread,
Jan 18, 2015, 4:43:42 PM1/18/15
to rubyonra...@googlegroups.com
On 18 January 2015 at 17:54, Nanduchocom <gere...@nanducho.com> wrote:
> I install ruby 2.1 and rails 4.2 in centos 7,
>
> But, when i try init:
> rails s
> Appear this messsages:

Did you install using rvm? I not then my first recommendation would
be to do that. It may not sort the problem but at least you know you
are following a route others have followed.

Colin

Michał Papis

unread,
Jan 19, 2015, 6:26:02 AM1/19/15
to rubyonra...@googlegroups.com
Did you used ruby (rvm use 2.1.2), create an app (rails new app_name) and changed to it's directory (cd app_name)?

Daniel Loureiro

unread,
Jan 19, 2015, 7:06:07 PM1/19/15
to rubyonra...@googlegroups.com
Try this:

source $HOME/.rvm/scripts/rvm
rails s


My guess is that you installed ruby via rvm *and* you don't add "source $HOME/.rvm/scripts/rvm" to your bash_profile.

--
Daniel Loureiro

Michał Papis

unread,
Jan 20, 2015, 5:45:58 AM1/20/15
to rubyonra...@googlegroups.com
Daniel his RVM is installed in /usr/local/rvm - for this RVM adds a file /etc/profiles.d/rvm.sh so sourcing $HOME/.rvm/scripts/rvm would not help (both scripts prefer $HOME/.rvm)

Nanduchocom

unread,
Jan 26, 2015, 11:48:31 PM1/26/15
to rubyonra...@googlegroups.com
I don't use rvm,

Now proceed to install from rvm.io.

Nanduchocom

unread,
Jan 27, 2015, 12:20:29 AM1/27/15
to rubyonra...@googlegroups.com
I proceed with the next steps.

1. Install rvm

 https://rvm.io/rvm/security

2. Install ruby

https://rvm.io/rvm/security

3. Verify

[root@localhost ~]# ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

4. Create new app ruby
 
[root@localhost ~]# ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]


[ieconsultores@localhost ~]$ rails new prueba2
      create 
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/views/layouts/application.html.erb
      create  app/assets/images/.keep
      create  app/mailers/.keep
      create  app/models/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
         run  bundle install
/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler.rb:301: warning: Insecure world writable dir /usr/local/rvm/gems in PATH, mode 042777


Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:

    bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.

Password:
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Installing rake 10.4.2
Installing i18n 0.7.0
Installing json 1.8.2
Installing minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.8
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.8
Using rack 1.5.2
Installing rack-test 0.6.3
Using actionpack 4.1.8
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.1.8
Using activemodel 4.1.8
Using arel 5.0.1.20140414130214
Using activerecord 4.1.8
Using bundler 1.7.7
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.8
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Installing jbuilder 2.2.6
Using jquery-rails 3.1.2
Using tilt 1.4.1
Using sprockets 2.12.3
Installing sprockets-rails 2.2.4
Using rails 4.1.8
Installing rdoc 4.2.0
Using sass 3.2.19
Using sass-rails 4.0.5
Using sdoc 0.4.1
Using spring 1.2.0
Using sqlite3 1.3.10
Installing turbolinks 2.5.3
Installing uglifier 2.7.0
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
         run  bundle exec spring binstub --all
/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local/rvm/gems in PATH, mode 042777
/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local/rvm/gems in PATH, mode 042777
* bin/rake: spring inserted
* bin/rails: spring inserted


5. And continue the problems:

[ieconsultores@localhost ~]$ cd prueba2

[ieconsultores@localhost prueba2]$ rails server
/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local/rvm/gems in PATH, mode 042777
/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local/rvm/gems in PATH, mode 042777
/usr/local/rvm/gems/ruby-2.1.2/gems/execjs-2.2.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /usr/local/rvm/gems/ruby-2.1.2/gems/execjs-2.2.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/execjs-2.2.2/lib/execjs.rb:4:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/uglifier-2.7.0/lib/uglifier.rb:3:in `require'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/uglifier-2.7.0/lib/uglifier.rb:3:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in `require'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in `each'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in `block in require'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in `each'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in `require'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler.rb:133:in `require'
    from /home/ieconsultores/prueba2/config/application.rb:7:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:79:in `require'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:79:in `block in server'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/ieconsultores/prueba2/bin/rails:8:in `require'
    from /home/ieconsultores/prueba2/bin/rails:8:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `load'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `call'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/spring-1.2.0/lib/spring/client/command.rb:7:in `call'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/spring-1.2.0/lib/spring/client.rb:26:in `run'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/spring-1.2.0/bin/spring:48:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `load'
    from /usr/local/rvm/gems/ruby-2.1.2/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/ieconsultores/prueba2/bin/spring:16:in `require'
    from /home/ieconsultores/prueba2/bin/spring:16:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'




El martes, 20 de enero de 2015, 5:45:58 (UTC-5), Michał Papis escribió:

Scott Ribe

unread,
Jan 27, 2015, 12:27:49 AM1/27/15
to rubyonra...@googlegroups.com, Nanduchocom
On Jan 26, 2015, at 10:20 PM, Nanduchocom <gere...@nanducho.com> wrote:
>
> /usr/local/rvm/gems/ruby-2.1.2/gems/execjs-2.2.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

That's the error you need to address.

--
Scott Ribe
scott...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




Clayton Cottingham

unread,
Jan 27, 2015, 1:11:38 AM1/27/15
to rubyonra...@googlegroups.com
One of the easiest ways is
Add to Gemfile
gem 'execjs'
gem 'therubyracer'

Then just run bundle install



On 26 January, 2015 9:27:11 PM PST, Scott Ribe <scott...@elevated-dev.com> wrote:
On Jan 26, 2015, at 10:20 PM, Nanduchocom <gere...@nanducho.com> wrote:

/usr/local/rvm/gems/ruby-2.1.2/gems/execjs-2.2.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

That's the error you need to address.

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Michał Papis

unread,
Jan 27, 2015, 5:59:14 PM1/27/15
to rubyonra...@googlegroups.com
your ruby is:


> ruby -v
> ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

but rails new prints:


> /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler.rb:301: warning: Insecure world writable dir /usr/local/rvm/gems in PATH, mode 042777

which means you are not using RVM ruby properly, in "prueba2" directory please run:

    rvm use ruby-2.1.2 &&
    bundle install

if there are any instructions printed on the way make sure to follow them and try repeating till it works

Nanduchocom

unread,
Jan 28, 2015, 12:00:35 AM1/28/15
to rubyonra...@googlegroups.com
I use the command and next execute the app prueba2

rails server

And appear the next message:


which means you are not using RVM ruby properly, in "prueba2" directory please run:

    rvm use ruby-2.1.2 &&
    bundle install

Thank you very much
Fernando Torres

Nanduchocom

unread,
Jan 28, 2015, 12:04:53 AM1/28/15
to rubyonra...@googlegroups.com
Excusme, i don't know if you see the message error:

Colin Law

unread,
Jan 28, 2015, 3:54:52 AM1/28/15
to rubyonra...@googlegroups.com
On 28 January 2015 at 05:04, Nanduchocom <gere...@nanducho.com> wrote:
> Excusme, i don't know if you see the message error:

Which error? Your original error message should no longer appear if
you have followed the earlier suggestions.

Probably the best way to ensure you are using the correct ruby version
in your app is to put a .ruby-version file in the top level of the
application, containing the ruby version number that you want to use
for that app.

Colin

Michał Papis

unread,
Jan 28, 2015, 5:12:32 AM1/28/15
to rubyonra...@googlegroups.com

/usr/local/rvm/gems/ruby-2.1.2/gems/execjs-2.2.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
Reply all
Reply to author
Forward
0 new messages