Installing ruby 2.1 and rails 4.2 in centos 7

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:inrescue 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:inrequire’
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:inload’
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:ineval’
from
/usr/local/rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in
`’

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

On 18 January 2015 at 17:54, Nanduchocom [email protected] 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

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 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)

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 L.

I don’t use rvm,

Now proceed to install from rvm.io.

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

On Jan 26, 2015, at 10:20 PM, Nanduchocom [email protected] 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
GitHub - sstephenson/execjs: Run JavaScript code from Ruby for a list of available runtimes.
(ExecJS::RuntimeUnavailable)

That’s the error you need to address.


Scott R.
[email protected]
http://www.elevated-dev.com/
(303) 722-0567 voice

I proceed with the next steps.

  1. Install rvm

RVM: Ruby Version Manager -

  1. Install ruby

https://rvm.io/rvm/security

  1. Verify

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

  1. 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
  1. 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

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

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

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

El martes, 27 de enero de 2015, 17:59:14 (UTC-5), Michał Papis escribió:

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 R.
[email protected] wrote:

You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/86FA84FE-636F-46F0-A623-0B17E74DFE03%40elevated-dev.com.
For more options, visit https://groups.google.com/d/optout.


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

Excusme, i don’t know if you see the message error:

/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:inmodule: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:inrequire’
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:inrequire’
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:ineach’
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:ineach’
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:inrequire’
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:inrequire’
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:intap’
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:inrun_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:inrequire’
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:inload’
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:incall’
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

El miércoles, 28 de enero de 2015, 0:00:35 (UTC-5), Nanduchocom
escribió:

On 28 January 2015 at 05:04, Nanduchocom [email protected] 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

/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
GitHub - sstephenson/execjs: Run JavaScript code from Ruby for a list of available runtimes.
(ExecJS::RuntimeUnavailable)

for this error check

  • the solution varies depending on your operating system