我正试着在cygwin (windows7)上运行Rails博客入门。我收到以下错误消息:
ExecJS::RuntimeError in Welcome#index
module.js:340
throw err;
^
Error: Cannot find module 'C:\tmp\execjs20130903-50672-1vn7gqc.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
(in /usr/lib/ruby/gems/1.9.1/gems/turbolinks-1.3.0/lib/assets/javascripts /turbolinks.js.coffee)
节点已安装。
这是之后的
$rails generate controller welcome index
$rails s
我正在运行Rails 4.0在cygwin上,知道为什么会发生这种情况吗?
谢谢
乌贼龙
发布于 2014-04-02 19:55:17
我遇到了这个错误,这与临时文件的路径错误有关。我能够通过在\gems\[ruby version]\gems\execjs-2.0.2\lib\execjs
中更改以下两个文件来修复它。(可能在\usr\lib\ruby\
中找到,但这取决于您的Ruby是如何安装的。我使用的是RVM,所以我的不同。)
external_runtime.rb
compile_to_tempfile(source) do |file|
extract_result(@runtime.send(:exec_runtime, file.path))
end
end
应改为
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服务器,如果幸运的话,它应该可以工作。
发布于 2017-11-16 13:55:04
不要做任何事情,只需转到application/assets/javascript/application.js,然后删除
“//”
从…
/需要涡轮发动机
至
=需要涡轮筒
这将基本上取消对文件中的行的注释,这一步使我在默认rails服务器通过RAILS教程时遇到类似错误时完成了工作。我用的是Windows 10 PC,这解决了我的案子
https://stackoverflow.com/questions/18599718
复制相似问题