Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在cygwin(windows7)上运行Rails入门博客时出错_Ruby On Rails - Fatal编程技术网

Ruby on rails 在cygwin(windows7)上运行Rails入门博客时出错

Ruby on rails 在cygwin(windows7)上运行Rails入门博客时出错,ruby-on-rails,Ruby On Rails,我正在尝试在cygwin(windows7)上运行Rails入门博客。我收到以下错误消息: ExecJS::欢迎索引中的RuntimeError 节点已安装 这是在 $rails generate controller welcome index $rails s 我在cygwin上运行Rails 4.0 你知道为什么会这样吗 谢谢 umbregachoong我遇到了这个错误,这与临时文件的路径错误有关。我可以通过在\gems\[ruby version]\gems\execjs-2.0.2\

我正在尝试在cygwin(windows7)上运行Rails入门博客。我收到以下错误消息:

ExecJS::欢迎索引中的RuntimeError

节点已安装

这是在

$rails generate controller welcome index
$rails s
我在cygwin上运行Rails 4.0 你知道为什么会这样吗

谢谢


umbregachoong

我遇到了这个错误,这与临时文件的路径错误有关。我可以通过在
\gems\[ruby version]\gems\execjs-2.0.2\lib\execjs
中更改以下两个文件来修复它。 (可能在
\usr\lib\ruby\
中找到,但这取决于ruby的安装方式。我使用的是RVM,所以我的不同。)

外部运行时.rb 应改为

compile_to_tempfile(source) do |file|
    filepath = file.path
    if ExecJS.cygwin? && @runtime.name == "JScript"
      IO.popen("cygpath -m " + file.path) { |f| filepath = f.read }
      filepath = filepath.gsub("\n","")
    end
    extract_result(@runtime.send(:exec_runtime, filepath))
  end
end
module.rb 将此项添加到最后两个
end
s之前

def cygwin?
  @cygwin ||= RbConfig::CONFIG["host_os"] =~ /cygwin/
end
在此之后,重新启动Rails服务器,如果运气好的话,它应该可以工作


来源:

不要做任何事情,只需转到application/assets/javascript/application.js并删除

“/”

//=需要涡轮链路

=需要涡轮链路

这将基本上取消对文件中的行的注释
当我在阅读rails教程时,在默认rails服务器中遇到类似错误时,这一步完成了我的工作。我使用的是Windows 10 PC,这解决了我的问题

如果用rubyracer gem替换Node.js,会有什么变化吗?(我不指望它能解决问题,但以防万一…)太棒了!我在Cgywin上的execjsv2.2.0也有类似的问题,尽管那里的具体实现略有不同,但原理是相同的!多谢各位+1.
compile_to_tempfile(source) do |file|
    filepath = file.path
    if ExecJS.cygwin? && @runtime.name == "JScript"
      IO.popen("cygpath -m " + file.path) { |f| filepath = f.read }
      filepath = filepath.gsub("\n","")
    end
    extract_result(@runtime.send(:exec_runtime, filepath))
  end
end
def cygwin?
  @cygwin ||= RbConfig::CONFIG["host_os"] =~ /cygwin/
end