Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON::GeneratorError in Admins#new #32

Closed
redcat34 opened this issue Aug 25, 2013 · 15 comments
Closed

JSON::GeneratorError in Admins#new #32

redcat34 opened this issue Aug 25, 2013 · 15 comments
Labels

Comments

@redcat34
Copy link

Showing /home/ubuntu/Documents/deneme/boxroom/app/views/layouts/application.html.erb where line #10 raised:

only generation of JSON objects or arrays allowed
(in /home/ubuntu/Documents/deneme/boxroom/app/assets/javascripts/application.js.coffee)

ty

@mischa78
Copy link
Owner

I cannot reproduce this, but there seems to be a problem with some gems. See:

http://stackoverflow.com/questions/18399655/rails-4-asset-pipeline-throws-only-generation-of-json-objects-or-arrays-allowed and http://stackoverflow.com/questions/18394817/json-error-with-coffeescript-rails-asset-pipeline

Please let me know if the above links help you fix this problem.

@kumardev
Copy link

I encountered the same error , even including multi_json 1.7.8 doesn't solve this issue .

@kumardev
Copy link

Actually i tried it with 1.9.3 , it threw the same error . Tried with 2.0.0 and the error goes away .

@mischa78
Copy link
Owner

Thanks @kumardev, I can reproduce it now. I will look into a solution for this.

@mischa78
Copy link
Owner

It seems execjs 2.0.0 is the culprit. See this issue. I added gem 'execjs', '1.4.0' to the Gemfile for now, which seems to fix it.

@ixti
Copy link

ixti commented Aug 27, 2013

@mischa78 issue was fixed in just released execjs v2.0.1

@mischa78
Copy link
Owner

Thanks @ixti

@mischa78
Copy link
Owner

@ixti I upgraded to execjs 2.0.1, but I still get the same error when using Ruby 1.9.3. This happens in a CoffeeScript file in my Rails 4 project. Am I doing something wrong? Should the mentioned issue be reopened?

@ixti
Copy link

ixti commented Aug 27, 2013

It's really strange. Let me recheck.

UPDATE

I have:

  • cloned master of your repo
  • removed execjs gem from Gemfile
  • bundle update
  • bundle exec rake assets:precompile

Compiled all assets without any problems.
Can you please post a backtrace?

@mischa78
Copy link
Owner

Ruby version: ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin10.8.0]

I'm using these gems:

Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Using atomic (1.1.13)
Using thread_safe (0.1.2)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.24)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using acts_as_tree (1.4.0)
Using bundler (1.3.1)
Using climate_control (0.0.3)
Using cocaine (0.5.1)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using dynamic_form (1.1.4)
Using factory_girl (4.2.0)
Using factory_girl_rails (4.2.1)
Using hike (1.2.3)
Using jquery-fileupload-rails (0.4.1)
Using jquery-rails (3.0.4)
Using paperclip (3.5.1)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using sass (3.2.10)
Using sass-rails (4.0.0)
Using sqlite3 (1.3.8)
Using uglifier (2.2.0)

Here's the trace:

only generation of JSON objects or arrays allowed
  (in /Users/mischa78/Sites/current_projects/boxroom/app/assets/javascripts/application.js.coffee)
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:53:in `block (2 levels) in compile'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:51:in `sub!'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:51:in `block in compile'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:47:in `tap'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:47:in `compile'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:39:in `compile_to_tempfile'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:27:in `exec'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:19:in `eval'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:33:in `call'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/coffee-script-2.2.0/lib/coffee_script.rb:57:in `compile'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/tilt-1.4.1/lib/tilt/coffee.rb:46:in `evaluate'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/context.rb:197:in `block in evaluate'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `each'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `evaluate'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:12:in `initialize'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `new'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/base.rb:373:in `build_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/bundled_asset.rb:37:in `init_with'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/asset.rb:24:in `from_hash'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/caching.rb:54:in `cache_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:257:in `benchmark'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:210:in `find_asset'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:119:in `block in compile'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `each'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `compile'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-2.10.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
/Users/mischa78/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile

Thanks for your help.

@ixti
Copy link

ixti commented Aug 28, 2013

OK. That's really similar problem but in a different place. I wonder why it worked on my local machine o_O I'll provide a fix ASAP. Thanks.

@mischa78
Copy link
Owner

Great! Thanks again.

@ixti
Copy link

ixti commented Sep 8, 2013

@mischa78 I have made new PR to ExecJS, so once it will be merged it should be finally fixed. Sorry for delay.

@mischa78
Copy link
Owner

mischa78 commented Sep 9, 2013

Yes, I saw it. Thank you. I'll just keep 1.4.0 in my Gemfile till your PR gets merged, so no problem.

@ixti
Copy link

ixti commented Oct 6, 2013

@mischa78 ExecJS v2.0.2 contains a proper fix (all places are string aware)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants