2012-03-23 5 views
1

Ich verfolge die demo_app in Michael Hartl's book Ruby on Rails 3 Tutorail. Die Demo ist ein einfacher Scaffold Benutzername: string E-Mail: stringJavascript funktioniert nicht für javascrip_inlcue-tag Schienen 3.2.2

ich einen Fehler in meinem application.html.erb Datei bekommen:

Errno::EINVAL in Users#index 
Showing ~/demo_app/app/views/layouts/application.html.erb where line #6 raised: 
Invalid argument - cscript //E:jscript //Nologo //U /tmp/execjs20120323-4388-1an85xw-0.js 2>&1 
(in ~/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> 

wenn ich line # chnage 6 bis:

<%= javascript_include_tag "default" %> 

Das Programm wird perfekt laufen, außer es wird mir nicht erlauben, Benutzer zu löschen (vermutlich, weil es nicht das Javascript laufen lässt).

Umweltinfo:

$ ruby -v 
ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-cygwin] 

$ rails -v 
Rails 3.2.2 

Inhalt von ~ \ demo_app \ app \ assets \ javascripts \ users.js.coffee:

# Place all the behaviors and hooks related to the matching controller here. 
# All this logic will automatically be available in application.js. 
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 

Inhalt von ~ \ demo_app \ app \ assets \ javascripts \ application.js

// This is a manifest file that'll be compiled into application.js, which will include all the files 
// listed below. 
// 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 
// 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// the compiled file. 
// 
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 
// GO AFTER THE REQUIRES BELOW. 
// 
//= require jquery 
//= require jquery_ujs 
//= require_tree . 
+0

Veröffentlichen Sie Ihre Datei 'users.js.coffee'. – James

+0

Können Sie den Inhalt von app/assets/javascripts/users.js.coffee posten. Stellen Sie außerdem sicher, dass Sie die Version des Buchs für Rails 3.2 - http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2 –

+0

john befolgen und bestätigen, dass ich der Version = 3.2 folge. – glennm

Antwort

1

try gem 'therubyracer' Kommentar- und run Bündel, und es ist auch besser, letzte stabile Version von Rubin zu verwenden

+0

Ich entfernte die kommentierung auf therubyracer und bündel install ran in ein problem mit dem libv8 gem. Fehler: "Bei der Installation von libv8 (3.3.10.4) ist ein Fehler aufgetreten, und Bundler kann nicht fortfahren. Stellen Sie sicher, dass 'gem install libv8 -v' 3.3.10.4 '' vor dem Bündeln erfolgreich ist." – glennm

+0

unstall libv8: git clone [email protected]: fractaloop/libv8 cd libv8 git Submodul Update --init Bündel Bündel exec Rake kompilieren –

+0

Said installieren, obwohl ich das Programm habe arbeiten ok, ich sollte folgen Sie immer noch Ihrem Vorschlag, den Edelstein therubyracer auskommentieren und libv8 deinstallieren? – glennm

0

Ich suchte nach anderen Fragen, die den Edelstein therubyracer diskutierten. Ich fand eine Antwort, die nahelegte, was Said Kaldybaev hier vorgeschlagen hatte. Das hat bei mir nicht funktioniert. Aber es war ein weiterer suggestiong den Code

//= require_tree . 

aus der App/assets/Javascripts/application.js Datei zu entfernen.

Durch das Löschen dieses Codes funktionierte die Anwendung (einschließlich der Funktion zum Zerstören).

Verwandte Themen