Hi everyone I am having a very frustrating issue at the moment. Everything seemed to be working fine until I tried to run a rake db:migrate and it fails saying 'autodetect' : Could not find a JavaScript runtime. So I thought maybe it was something on my Windows machine and restarted now I cant even start my rails app with a "rails s" because I get the same error message. After googling around I see people suggesting installing nodejs and the gem 'therubyracer', :platform => :ruby.
大家好,我现在有一个非常令人沮丧的问题。在我尝试运行rake db:migrate并且它无法说'autodetect'之前,一切似乎都正常工作:无法找到JavaScript运行时。所以我想也许这是我的Windows机器上的东西并重新启动现在我甚至无法使用“rails s”启动我的rails应用程序,因为我收到相同的错误消息。谷歌搜索后,我看到有人建议安装nodejs和gem'therubyracer',:platform =>:ruby。
I already had both of them installed on my machine and appear to be working. Has anyone else had this happen? Im on windows 7 and here is my gem file.
我已经在我的机器上安装了它们并且似乎正在工作。这事发生在别人身上过吗?我在Windows 7上,这是我的宝石文件。
gem 'rails', '4.1.8'
gem 'pg'
gem "paperclip", "~> 4.2"
gem 'carrierwave'
gem 'jquery-turbolinks'
gem "jquery-fileupload-rails"
gem "mini_magick"
gem 'tinymce-rails'
gem 'devise'
gem 'bcrypt', '~> 3.1.9'
gem 'therubyracer', :platform => :ruby
and here is the error message
这是错误信息
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/execjs-1.2.4/lib/execjs/run
times.rb:45:in `autodetect': Could not find a JavaScript runtime. See https://gi
thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
2 个解决方案
#1
Visit https://github.com/sstephenson/execjs
as suggested and try installing any of the listed runtimes (for example Node.js)
按照建议访问https://github.com/sstephenson/execjs并尝试安装任何列出的运行时(例如Node.js)
#2
thanks for your help.
谢谢你的帮助。
In the end in order to fix this I uninstalled and re installed the railsinstaller. Based on another stack overflow answer where the person fixed this issue by formatting their HDD, a bit of overkill... but anyways that fixed the issue.
最后,为了解决这个问题,我卸载并重新安装了railsinstaller。基于另一个堆栈溢出答案,其中人通过格式化他们的硬盘修复此问题,有点矫枉过正......但无论如何解决了这个问题。
#1
Visit https://github.com/sstephenson/execjs
as suggested and try installing any of the listed runtimes (for example Node.js)
按照建议访问https://github.com/sstephenson/execjs并尝试安装任何列出的运行时(例如Node.js)
#2
thanks for your help.
谢谢你的帮助。
In the end in order to fix this I uninstalled and re installed the railsinstaller. Based on another stack overflow answer where the person fixed this issue by formatting their HDD, a bit of overkill... but anyways that fixed the issue.
最后,为了解决这个问题,我卸载并重新安装了railsinstaller。基于另一个堆栈溢出答案,其中人通过格式化他们的硬盘修复此问题,有点矫枉过正......但无论如何解决了这个问题。