adyouri
adyouri

Reputation: 243

ruby on rails error when running the server or generating something

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

Upvotes: 0

Views: 219

Answers (1)

Justin Ho Tuan Duong
Justin Ho Tuan Duong

Reputation: 606

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.

Upvotes: 1

Related Questions