Javascript files are not included from manifest

无人久伴 提交于 2019-12-08 11:23:00

问题


I am using Ruby On Rails and have ActiveAdmin on top of that on a windows machine. I don´t think ActiveAdmin has anything to do with it, but I am just saying.

The Javascript file that is included via HTML is /assets/active_admin.js and the manifest file itself looks like this:

//= require active_admin/base

//= require just_datetime_picker/nested_form_workaround

When I run my Rails application and open http://localhost:3000/assets/active_admin.js, the log tells me, that active_admin.js was compiled, but the file still looks just like the manifest just with an added semicolon at the end:

//= require active_admin/base

//= require just_datetime_picker/nested_form_workaround
;

Why is no Javascript code included?

When I try to run the precompile pipeline manually via bundle exec rake assets:precompile RAILS_ENV=development, it actually creates all the CSS files, but the JS files still look like the one described above.

Since I am operating on a windows machine, I do not have the gem 'therubyracer' installed, but NodeJS. Also the bundle install works fine and I also do not get any errors.


回答1:


Are you using Ruby v2.0? Try downgrading to 1.9.

Symptom: The JavaScript manifest file does not compile, no errors are shown; however, a mysterious semi-colon ; appears at the end of the file after "preprocessing" the assets.

Solution: Downgrade to Ruby v1.9.3!

See two other posts on the same topic.

  • My Rails Javascript manifest file neither compiles nor include any required files
  • Javascript manifest file "application.js" is not processed

What a sorry mess it is to be programming in 2013!



来源:https://stackoverflow.com/questions/17339984/javascript-files-are-not-included-from-manifest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!