Could not find gem 'uglifier' in the current bundle

只谈情不闲聊 提交于 2019-12-11 05:14:30

问题


My simple web app runs ok on Windows 7. Now I am moving it to bluehost.

Getting this error when starting the app:

ActionView::Template::Error (cannot load such file -- uglifier

Trying to resolve it I have run 'gem install uglifier' and seems to mostly work:

SSH# gem install uglifier
Successfully installed uglifier-1.3.0
1 gem installed
Installing ri documentation for uglifier-1.3.0...
unable to convert "\xC2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII  for README.md, skipping
Installing RDoc documentation for uglifier-1.3.0...
unable to convert "\xC2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for README.md, skipping

But when I try to locate the gem, it is not found:

bundle show uglifier

yields: Could not find gem 'uglifier' in the current bundle

Gemfile includes the following:

group :assets do
  gem 'therubyracer'
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

and Gemfile.lock shows that the uglifier gem is installed:

uglifier (1.3.0)

$PATH information:

/usr/local/jdk/bin:/home4/mychairs/perl5/bin:/usr/lib64/qt-3.3/bin:/home4/mychairs/perl5/bin:/ramdisk/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin:/home4/mychairs/ruby/gems/bin:/home4/mychairs/ruby/gems:/home4/mychairs/bin

回答1:


For starters you need to add the gem to your Gemfile at the root of your Rails application. See Bundler.

Simply include the uglifier gem somewhere in the assets group of your Gemfile:

Gemfile

group :assets do
  gem 'uglifier'
end 

Then you run the bundle install command to install all of the required gems. You can confirm exactly what gems are installed including version information by looking at the Gemfile.lock file.

If you don't already have an assets group then make one. I highly recommend reading up on bundler.




回答2:


try it with following in the app directory

#first
bundle
#then
bundle install


来源:https://stackoverflow.com/questions/13220329/could-not-find-gem-uglifier-in-the-current-bundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!