当前位置:  开发笔记 > 编程语言 > 正文

尝试加载gem'ugllifier'时出错.(捆扎机:: GemRequireError)

如何解决《尝试加载gem'ugllifier'时出错.(捆扎机::GemRequireError)》经验,为你挑选了2个好方法。

为什么我会收到此错误?

shibly@mybox:~/blog$ rails server
/home/shibly/.gem/ruby/2.2.4/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 /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
    from /home/shibly/blog/config/application.rb:7:in `'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands.rb:17:in `'
    from bin/rails:9:in `require'
    from bin/rails:9:in `

Marcos Serpa.. 250

您应该运行以下命令在Ubuntu中安装NodeJS

sudo apt-get install nodejs

或者为OSX运行它

brew install nodejs

Uglifier是一个JS包装器,它需要运行JS运行时或JS解释器.我会选择安装NodeJS.



1> Marcos Serpa..:

您应该运行以下命令在Ubuntu中安装NodeJS

sudo apt-get install nodejs

或者为OSX运行它

brew install nodejs

Uglifier是一个JS包装器,它需要运行JS运行时或JS解释器.我会选择安装NodeJS.


为什么它需要js env?

2> 小智..:

在默认的Rails Gemfile中,gem'therubyracer'的行被注释掉了.如果你取消注释它,你将得到那个宝石,它应该工作.

从" Rails入门 ":

编译CoffeeScript和JavaScript资产压缩需要您的系统上有可用的JavaScript运行时,如果没有运行时,您将execjs在资产编译期间看到错误.通常,Mac OS X和Windows都安装了JavaScript运行时.Rails将therubyracergem 添加到Gemfile新应用程序的注释行中生成,如果需要,可以取消注释.therubyrhino是JRuby用户的推荐运行时,默认情况下会添加到GemfileJRuby下生成的应用程序中.您可以在ExecJS上调查所有支持的运行时.


谢谢!这比依赖NodeJS更容易,更清晰.
推荐阅读
ifx0448363
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有