ExecJS :: ProgramError application in Rails for demo

I am following the tutorial at http://ruby.railstutorial.org/chapters/a-demo-app#sec:planning_the_application . After generating the scaffold for users. when i try to access localhost: 3000 / users. I got the following error in ExecJS

Started GET "/users" for 127.0.0.1 at 2012-08-01 13:35:37 -0500 Connecting to database specified by database.yml Processing by UsersController#index as HTML User Load (0.1ms) SELECT "users".* FROM "users" Rendered users/index.html.erb within layouts/application (3.1ms) Completed 500 Internal Server Error in 458ms ActionView::Template::Error (ExecJS::ProgramError (in /Users/kylec/apps/demo_app/app/assets/javascripts/users.js.coffee)): 3: <head> 4: <title>DemoApp</title> 5: <%= stylesheet_link_tag "application", :media => "all" %> 6: <%= javascript_include_tag "application" %> 7: <%= csrf_meta_tags %> 8: </head> 9: <body> app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___642905557_18993590' app/controllers/users_controller.rb:7:in `index' 

The page is displayed if I exit the application #line 6 <% = javascript_include_tag "%> I run ruby ​​1.9.3, rails 3.2.7, osx 10.5.8

+1
source share
5 answers

You need to look in your gemfile. Find this line and uncomment it.

 # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', :platforms => :ruby 
+1
source

I ran into a similar problem. I installed node.js and add the path to ruby ​​and it worked.

+1
source

In my case, it was a solution: I just changed the gemfile, dropping the script-source coffee to 1.8.0, and voila! Here is my gemfile:

 # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.1.0' # Downgrade coffee-script source gem 'coffee-script-source', '~>1.8.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' 
+1
source

If you work on windows, this definitely works:

On your /app/views/layouts/application.html.erb lines 5 and 6, change the application of the first parameter to the default value.

I met the same problem for my situation, I don’t know why, but this only happens on Windows. The settings application runs on a web server.

0
source

For Windows:

On your /app/views/layouts/application.html.erb lines 5 and 6, change the application of the first parameter to the default value.

I met the same problem

it helped me: change the "application" to "default"

my code is:

  <!DOCTYPE html> <html> <head> <title>AppSample</title> <%= stylesheet_link_tag 'default', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'default', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> </head> <body> <%= yield %> </body> </html> 
0
source

Source: https://habr.com/ru/post/981002/


All Articles