Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4 asset pipeline throws "only generation of JSON objects or arrays allowed"

This may be related to JSON error with coffeescript & Rails asset pipeline

I'm working on an app in Rails 4. I have an asset called tasks.js.coffee. Until recently everything was fine. This morning I wanted to make a change, and Rails throws "only generation of JSON objects or arrays allowed".

It seems that any change is sufficient to throw the error, even removing a blank line, or changing a single character in a string. When I revert changes it works again.

I'm assuming some gems got updated yesterday when I did a bundle update, causing this problem.

Did anybody else see it? Does anyone know what causes this problem, and how to fix it?

like image 538
Erik Avatar asked Aug 23 '13 09:08

Erik


2 Answers

Update your ruby version to 2.0.0.

like image 20
KeFA Avatar answered Nov 10 '22 09:11

KeFA


I had to set the execjs version in the Gemfile to 1.4.0: gem 'execjs' '1.4.0'. The recent update to 2.0.0 seems to be the one causing the issue.

like image 90
And2 Avatar answered Nov 10 '22 08:11

And2