Error When Running Rails App - Execjs::Runtimeerror

Error when running rails app - ExecJS::RuntimeError

you have to install an additional gem for javascript.
edit gemfile and add gem 'therubyracer'. You can then run bundle to install the new gem.

here is your solution in detail:
http://www.railszilla.com/2011/12/rails-3-coffescript-execjs/

Rails 5 - ExecJS::RuntimeError

After Ziyan Junaideens pointer I searched all my CoffeeScript files and finally found I had left a method call unfinished... >_<

received: (data) ->
App.online_status. #<--- right here

So what did I learn? Never program when you are dead tired - or you'll spend the whole next day searching for the stupid mistake! ^^*

Heroku push - ExecJS::RuntimeError: SyntaxError: Name expected

I discovered that the cause of this issue is related to a possible bug in Uglifier when it tries to process a third party library named js-datepicker (datepicker.js). I opened up an issue on the Uglifier Github: https://github.com/lautis/uglifier/issues/124

I figured out a workaround for this by including the minified js-datepicker in my app/assets/javascripts/application.js file like this.

//= require js-datepicker/datepicker.min

javascript_include_tag application giving error ExecJS::RuntimeError at / SyntaxError: [stdin]:1:1: unexpected //=

I did finally figure out what this was.

The older versions of rails in this case v4.2.1 used the javascript_include_tag for the line that deals with application:

= javascript_include_tag "application"

In the newer versions of rails in my case v6.1.3.1 you have to use javascript_pack_tag

= javascript_pack_tag

This solved the issue and the views all started working. I did mention above I was working on a PC running Rails v6.1.3; however I noticed I didn't make it clear that I was also having to upgrade this program from Ruby v2.2.2 and Rails v4.2.1 to Ruby v 2.7.2 and Rails v6.1.3, that might have helped to have made that more clear. Apologies if that confused anyone. I am still VERY new to Rails and using StackOverflow.com. I am happy to report I have only 1 single issue left on this program and the rest of the program is all working properly. I will be posting another question in fact because the last issue deals with a complicated scope query and it uses different syntax again due to the newer version of rails and I haven't been able to figure it out. In any even if you are running an older version of Rails and you are trying to get the program to work on a newer version (my case as I couldn't get rails v4.2 to run or work on ANYTHING, PC, Linux nothing) then you have to change the include_tag to a pack_tag. I do not pretend to say I fully understand why. I know it has to do with webpacker but beyond that I am still learning Rails. Perhaps someone with more knowledge than myself can shed some insite as to why the syntax changed. Oh and in addition the line ended up needing to read as follows:

= javascript_pack_tag "application", "data-turbolinks-track": "reload"

I didn't have the turbolinks reference either.

I hope this helps someone else in a similar situation that I was in, it was not easy to find. I only discovered it when I went through some tutorials on making other generic apps and saw the difference on that line.

ExecJS::Runtime Error

Please look at this answer: ExecJS::RuntimeError on Windows trying to follow rubytutorial.

I edited these files last week for a co-worker and it works fine now. If you go into execjs's runtimes.rb file, and change those lines, it should work. This problem is happening a lot on Windows.



Related Topics



Leave a reply



Submit