0

I successfully made a new rails project!

But when I try to generate something in a rails project or start rails server by typing rails server or creating a controller rails g controller I get the same error (I try to run bundle install before this; I have Rails 4.1.1) :

Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
/var/lib/gems/1.9.1/gems/execjs-2.1.0/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 /var/lib/gems/1.9.1/gems/execjs-2.1.0/lib/execjs.rb:5:in `<module:ExecJS>'
    from /var/lib/gems/1.9.1/gems/execjs-2.1.0/lib/execjs.rb:4:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `require'
    from /var/lib/gems/1.9.1/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `<top (required)>'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `require'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:70:in `each'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:70:in `block in require'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:59:in `each'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:59:in `require'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:132:in `require'
    from /home/abd/rorblog/blog/config/application.rb:7:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:82:in `require'
    from /var/lib/gems/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:82:in `preload'
    from /var/lib/gems/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
    from /var/lib/gems/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
    from /var/lib/gems/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
    from /var/lib/gems/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
    from /var/lib/gems/1.9.1/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'
Veger
  • 37,240
  • 11
  • 105
  • 116
adyouri
  • 243
  • 1
  • 2
  • 7
  • 2
    possible duplicate of [ExecJS and could not find a JavaScript runtime](http://stackoverflow.com/questions/6282307/execjs-and-could-not-find-a-javascript-runtime) –  Jun 04 '14 at 00:05
  • no this is not my error :( – adyouri Jun 04 '14 at 00:07
  • Take a close look at line 2 of the stacktrace you posted. –  Jun 04 '14 at 00:09
  • I know but I have other errors I have a problem with spring – adyouri Jun 04 '14 at 00:11
  • Can you elaborate on the Spring problem? –  Jun 04 '14 at 00:13
  • Thank a lot bro I found the solution :D ; but i have now a routing error : " No route matches [GET] "/posts" " after generating a controller called posts ^_^ do you have any solution ? – adyouri Jun 04 '14 at 00:24
  • post a separate question (remember to do some research first!). from the sounds of it, check your `routes.rb` –  Jun 04 '14 at 00:26

1 Answers1

1

For the No route matches [GET] "/posts" error, go to your config/routes.rb file and add this:

resources :posts

And I really encourage you to find a decent beginners tutorial or read the official manual to get to know Rails.