简体   繁体   中英

Ruby on Rails - $ rails server fails because uglifier gem could not be found

I'm starting my first project on Ruby and the tutorial I'm following has me using rails. When I try to run $ rails server I get an error that says: Could not find gem uglifier (>=1.3.0) x86-mingw32 in the gems available on this machine.

I had this error with a few other gems, and I was able to fix it by simply doing the gem install of the gem at hand, but this one is giving me errors. These errors started to appear after I tried to install the dev kit for the first time. When I try $ gem install uglifier I get a large mess of errors that can be seen here .

I am running on a Windows 8 tablet. While I realize Ubuntu is the preference for this situation, I'm trying to make the best with what I'm given. Any help would be greatly appreciated.

  1. Locate your Gemfile {C:\\Users[your name]\\Desktop\\sample_app}
  2. In line 1, change https to http {source ' http://rubygems.org '}
  3. Save changes in Gemfile
  4. In your Gitbash, type "bundle install" and hit Enter

I was following these instructions: Installing Ruby, Rails and Rubymine in Ubuntu 14.04

and had the same problem when I got to testing the rails server. while creating the new demo:

abc@ubuntu:~/rails_demo$ rails new demo

An error occurred while installing uglifier (2.5.3), and Bundler cannot continue.Make sure that gem install uglifier -v '2.5.3' succeeds before bundling. run bundle exec spring binstub --al

I did not catch the above until I attempted to run the server

abc@ubuntu:~/rails_demo/demo$ rails server
Could not find gem 'uglifier (>= 1.3.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
abc@ubuntu:~/rails_demo/demo$ bundle install uglifier
ERROR: "bundle install" was called with arguments ["uglifier"]
Usage: "bundle install [OPTIONS]"

running the following fixed the problem:

gem install uglifier -v '2.5.3'

bundle exec spring binstub --all

hope it helps

Check if your Gemfile has the following gem

gem 'uglifier'

If the Gem is not present add it to your Gemfile. Sometimes it turns out that your Gemfile.lock has the dependency but you might have commented the Gem in Gemfile.

I you already have the gem in Gemfile run bundle install and check if the bundler is installing the uglifier gem

我在 Windows 10 中遇到了同样的问题,我修复了“gem install uglifier”命令,路径是这样的: C: \\ xampp \\ htdocs \\ parent_folder \\ name_project> gem install uglifier

** For Windows **

Install Nodejs. If it's already installed add it's path in Environment Variables

Variable Name: Path Location : Where node is installed (C:\\Program Files\\nodejs)

Re run The command rails server

运行“捆绑安装”,然后运行“捆绑更新”,这对我有用

安装 nodejs

apt-get install nodejs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM