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

前端 未结 7 1708
孤城傲影
孤城傲影 2021-01-06 13:08

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

相关标签:
7条回答
  • 2021-01-06 13:24

    I had the same problem in Windows 10, I fix the "gem install uglifier" command the path was like this: C: \ xampp \ htdocs \ parent_folder \ name_project> gem install uglifier

    0 讨论(0)
  • 2021-01-06 13:25

    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

    0 讨论(0)
  • 2021-01-06 13:35
    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
    0 讨论(0)
  • 2021-01-06 13:35

    install nodejs

    apt-get install nodejs
    
    0 讨论(0)
  • 2021-01-06 13:36

    ** 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

    0 讨论(0)
  • 2021-01-06 13:38

    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

    0 讨论(0)
提交回复
热议问题