There was an error while trying to load the gem 'uglifier'

I am new to rails.

After I setup env :

  1. created first project with command rails new firstrail

  2. Enter demo directory

  3. run command rails server

Here, I got the error :

uglifier 2.7.2 was installed. I don’t know how to fix this error.

Does any know how to fix this ?

Please help me out, thank you !

Do you see any errors if you run bundle install It should not have been necessary to run it manually as it is run automatically when you do rails new, but perhaps there was an error that you did not notice. It is necessary to re-run bundle if you change Gemfile.

Otherwise then post the details of the error when you run the server please. Copy/paste the full terminal output that you get when you run rails s

Colin

I fixed this error by uncommenting gem ‘therubyracer’, ‘platforms: :ruby’ # this is a javascript runtime

in Gemfile

Thank you, Colin.

在 2015年12月14日星期一 UTC+8下午5:05:54,Colin Law写道:

Glad to be of help, if I actually was any help.

Colin

and i have uncomment the ruby racer also plaes help me to sort out this problem.

Copy/paste the error you are getting here. Also tell us which operating system you are using.

Colin

Install nodejs on your system and you’ll be fine.

my operating system is: windows 7 and my rails version is: 4.2.5.1 and ruby is: ruby 2.1.8p440 (2015-12-16 revision 53160) [i386-mingw32] whenever i installed nodejs on system this error shows:

D:\rubyproject>gem install nodejs ERROR: Could not find a valid gem ‘nodejs’ (>= 0) in any repository ERROR: Possible alternatives: nodes, noderb, modeljs, models, node what do i do ? please help me

nodejs is not a gem.

Try installing from here

https://nodejs.org/en/download/stable/

Hi,

how to make install this nodejs on system i.e on Windows 7? please help me.

how to make install this nodejs on system i.e on Windows 7? please help me.

Just install the binary file. .exe file

how to redirect to any page after logout the user and destroy the sesssion? please help my problem is after logout my app redirect to my index page (root_path page) and i don’t want it .how to go to separate separate page after logout?

Hi ishant,

which gem you are using for authentication? I mean are you using devise or authlogic or your own authentication. What kind of user types you are using to redirect different pages after logout?

i dont see any error but, still when i run rails server it is showing the error There was an error while trying to load the gem ‘uglifier’

C:\Ruby21-x64\rails\firstapp>bundle install

Using rake 11.2.2

Using i18n 0.7.0

Using json 1.8.3

Using minitest 5.9.0

Using thread_safe 0.3.5

Using builder 3.2.2

Using erubis 2.7.0

Using mini_portile2 2.1.0

Using pkg-config 1.1.7

Using rack 1.6.4

Using mime-types-data 3.2016.0521

Using arel 6.0.3

Using debug_inspector 0.0.2

Using byebug 9.0.5

Using coffee-script-source 1.10.0

Using execjs 2.7.0

Using thor 0.19.1

Using concurrent-ruby 1.0.2

Using multi_json 1.12.1

Using bundler 1.12.5

Using sass 3.4.22

Using tilt 2.0.5

Using sqlite3 1.3.11

Using rdoc 4.2.2

Using tzinfo 1.2.2

Using nokogiri 1.6.8

Using rack-test 0.6.3

Using mime-types 3.1

Using binding_of_caller 0.7.2

Using coffee-script 2.4.1

Using uglifier 3.0.0

Using sprockets 3.6.0

Using sdoc 0.4.1

Using activesupport 4.2.6

Using tzinfo-data 1.2016.5

Using loofah 2.0.3

Using mail 2.6.4

Using rails-deprecated_sanitizer 1.0.3

Using globalid 0.3.6

Using activemodel 4.2.6

Using jbuilder 2.5.0

Using rails-html-sanitizer 1.0.3

Using rails-dom-testing 1.0.7

Using activejob 4.2.6

Using activerecord 4.2.6

Using actionview 4.2.6

Using actionpack 4.2.6

Using actionmailer 4.2.6

Using railties 4.2.6

Using sprockets-rails 3.0.4

Using coffee-rails 4.1.1

Using jquery-rails 4.1.1

Using rails 4.2.6

Using sass-rails 5.0.4

Using web-console 2.3.0

Using turbolinks 2.5.3

Bundle complete! 12 Gemfile dependencies, 56 gems now installed.

Use bundle show [gemname] to see where a bundled gem is installed.

C:\Ruby21-x64\rails\firstapp>

Hi,

i dont see any error but, still when i run rails server it is showing the error There was an error while trying to load the gem 'uglifier' C:\Ruby21-x64\rails\firstapp>bundle install

You should post the complete error instead of just the main message. Though it looks another case of windows script host error.

either: 1. use something more posix where ruby is actually intended to run (i.e. not windows) or 2. install nodejs (or just download node executable (node.exe) and put somewhere in your PATH)

The big problem you have is that you are trying to develop with Rails using Windows. I understand some have managed to achieve this but many have had significant problems. Most developers use Linux or Mac. My advice is to switch to a Linux distribution (such as Ubuntu). You can run this in a virtual machine under windows or you can dual boot the PC. I did the latter (using Ubuntu) when I started working with Rails and now very rarely boot into Windows as the vast majority of applications have equivalent apps on Ubuntu. It is great to feel that you are back in control of the PC after years of Microsoft dominance.

Colin