【问题标题】:Ruby on rails uglifier errorRuby on rails uglifier 错误
【发布时间】:2015-12-24 16:44:35
【问题描述】:

在 windows 上,是的,node.js 已安装。

我刚刚按照视频教程在 Rails 上安装了 ruby​​,但是当我运行 rails server 时出现此错误:

c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
        from c:/row/dev/Hello_World/config/application.rb:7:in `<top (required)>'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

我的 gemfile 中确实有 uglifier 已安装 uglifier,并且 bundle install 显示正在使用 uglifier。

可能是什么问题?

【问题讨论】:

标签: ruby-on-rails ruby uglifier


【解决方案1】:

似乎您没有安装 uglifier 需要的 JS 运行时。 你可以安装nodejs。

在 Ubuntu 上这样做的方式:

sudo apt-get update
sudo apt-get install nodejs

【讨论】:

  • nodejs 已安装并且据我所知可以正常工作。有没有办法确认?
  • @mike 只需在控制台中输入node -v。如果已安装,如果将显示一个版本。
  • @Mike 您能否尝试使用 ruby​​racer 将其添加到您的 gemfile gem 'therubyracer', platforms: :ruby 并运行捆绑安装。它可能会有所帮助。让我们看看它会带来什么。
  • 我收到了关于上一个问题的提示,即 therubyracer 无法在 Windows 上运行。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-06-15
  • 2014-04-17
  • 2011-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多