rails generate scaffold User name:string email:string
gives me this error:
/home/natmanu/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.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 /home/natmanu/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs.rb:5:inmodule:ExecJS’
from
/home/natmanu/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs.rb:4:in <top (required)>' from /home/natmanu/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.1/lib/uglifier.rb:3:inrequire’
from
/home/natmanu/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.1/lib/uglifier.rb:3:in <top (required)>' from /home/natmanu/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:inrequire’
from
/home/natmanu/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in block (2 levels) in require' from /home/natmanu/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:ineach’
from
/home/natmanu/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in block in require' from /home/natmanu/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:ineach’
from
/home/natmanu/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in require' from /home/natmanu/.rvm/gems/ruby-2.0.0-p247[email protected]/gems/bundler-1.3.5/lib/bundler.rb:132:inrequire’
from /home/natmanu/Sites/microblog/config/application.rb:7:in <top (required)>' from /home/natmanu/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:44:inrequire’
from
/home/natmanu/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:44:in <top (required)>' from bin/rails:4:inrequire’
from bin/rails:4:in `’
In order for Rails assets pipeline to handle JS it needs a JS runtime
installed on your machine. Since you said you’re on Ubuntu if you don’t
mind installing node you could just run sudo apt-get install nodejs.
Otherwise the execjs gem works well and makes your project a little more
portable.
I seem to be hitting some configuration errors every step of the tutorial.
IS there a way to check my config to see I have all that I need set up?
Now when I try: bundle exec rake db:migrate
is get Error: RVM Ruby not used, run ‘rvm use 1.9.1’ first
I’m not sure i understand the error. is should run: rvm use 1.9.1
I sympathise with you, trying to learn Ubuntu, rvm, ruby and rails all
at once can be a bit overwhelming. Persevere and all will become
clear in time. The error seems a bit odd. The rvm use command allows
you to specify which ruby you wish to use, I am surprised that it has
not defaulted to something. However you can easily set the default
ruby. First see which ones you have installed by running, in a
terminal
rvm list
Then to make one of the these the default run
rvm --default use 1.9.3
you don’t normally need the -pnnn patch number unless you have
multiple versions of the same ruby (which would not normally be a good
idea). In the error it said 1.9.1, I hope you are not using that
version (which does not play well with rails), it should probably be
1.9.3
No, problem. Could you not top post please, it makes it difficult to
follow the thread. Insert your reply at appropriate points in
previous message. Thanks.
* - default
So should i run
rvm --default use 1.9.3
or
rvm --default use 2.0.0
rvm list says you only have 2.0.0 installed, which I see is the one
recommended in the tutorial so that should be ok, so
rvm --default use 2.0.0
Then when you run rvm list again you see it with =* against it showing
that it is the current and default.
Looking at the tutorial I see that Ryan has included the command to
set the default in the section headed Ruby, presumably you missed that
bit.