2012년 10월 25일 목요일

rails server 실행시 `autodetect': Could not find a JavaScript runtime. 에러 해결방법

ruby, rails를 좀 해보려는데 처음부터 고난의 시작이다.
>rails new helloworld
>cd helloworld
>rails server
요렇게 시작했는데 아래 에러가 난다.

/usr/lib64/ruby/gems/1.8/gems/execjs-1.4.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 /usr/lib64/ruby/gems/1.8/gems/execjs-1.4.0/lib/execjs.rb:5
        from /usr/lib64/ruby/gems/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
        from /usr/lib64/ruby/gems/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1
        from /usr/lib64/ruby/gems/1.8/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
        from /usr/lib64/ruby/gems/1.8/gems/coffee-script-2.2.0/lib/coffee-script.rb:1
        from /usr/lib64/ruby/gems/1.8/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
...

열심히 구글을 뒤지니 아래와 같은 해결책이 있었다.

>gem install therubyracer
>gem install execjs
>bundle install

이렇게 해도 해결이 안된다. 다른 문제인 듯..
다시 찾은 해결책은 nodejs를 설치하는 것이다.
아래 페이지에서 해당 OS에 맞는 것으로 설치한다.

이래도 해결이 안된다면 Gemfile에서 "gem therubyracer"에 걸려있는 '#'을 지운다.
난 '#'을 지우는 것으로 해결.. 

댓글 없음:

FIX :: ssh 접속이 느리고, /var/log/messages에 systemd-logind.service failed. 메시지가 남을 때

ssh 접속이 느릴 때가 있습니다. 보통은DNS가 제대로 설정되지 않았는데 /etc/ssh/sshd_config에 UseDNS가 yes로 되어 있을 때 발생합니다. 위와 같을 경우 /etc/ssh/sshd_config파일에서 아래와 같이 수정 후 ...