【问题标题】:i am getting this error while running rails server command,please tell me how can i solve this? [duplicate]我在运行 rails server 命令时遇到此错误,请告诉我如何解决这个问题? [复制]
【发布时间】:2015-02-17 00:56:00
【问题描述】:
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.2.2/lib/execjs/run
times.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://gi
thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUn
available)
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.2.2/l
ib/execjs.rb:5:in `<module:ExecJS>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.2.2/l
ib/execjs.rb:4:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/uglifier-2.6.0
/lib/uglifier.rb:3:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/uglifier-2.6.0
/lib/uglifier.rb:3:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `each'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `block in require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `each'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler.rb:132:in `require'
        from c:/Sites/project/railgirl/config/application.rb:7:in `<top (require
d)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0
/lib/rails/commands.rb:76:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0
/lib/rails/commands.rb:76:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0
/lib/rails/commands.rb:73:in `tap'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0
/lib/rails/commands.rb:73:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

【问题讨论】:

  • 当您使用Windows时,请检查此answer

标签: ruby-on-rails


【解决方案1】:

如果您想快速设置它(无需担心 gem 代码大小等),请将其放入您的 Gemfile:

gem 'therubyracer'

然后运行

bundle install

【讨论】:

    【解决方案2】:

    那是因为您没有在 Windows 上安装 Javascript Runtime。 这是 ExecJS、TheRubyRacer 等所需的。

    除非您有 JS 运行时,否则这些 gem 将无法在 Windows 上正确编译。 我建议使用 gem therubyracer 并在 Windows 上安装 GoogleV8 Javascript 引擎:

    https://developers.google.com/v8/build

    您需要自己编译它并使其在您的 PATH 中可用。

    【讨论】:

      【解决方案3】:

      放入你的gemfile

      gem 'therubyracer',平台::ruby

      【讨论】:

        猜你喜欢
        • 2022-07-05
        • 1970-01-01
        • 1970-01-01
        • 2020-11-14
        • 1970-01-01
        • 1970-01-01
        • 2020-03-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多