清单文件中未包含Javascript文件 [英] Javascript files are not included from manifest

查看:76
本文介绍了清单文件中未包含Javascript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ruby On Rails,并且在Windows计算机上具有ActiveAdmin.我不认为ActiveAdmin与它有任何关系,但我只是在说.

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.

通过HTML包含的Javascript文件为/assets/active_admin.js,清单文件本身如下所示:

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

当我运行Rails应用程序并打开http://localhost:3000/assets/active_admin.js时,日志告诉我active_admin.js已编译,但是该文件看起来仍然像清单一样,只是在末尾添加了分号:

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
;

为什么不包含Javascript代码?

当我尝试通过bundle exec rake assets:precompile RAILS_ENV=development手动运行预编译管道时,它实际上创建了所有CSS文件,但是JS文件仍然看起来像上面描述的那样.

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.

由于我在Windows计算机上运行,​​因此未安装gem'therubyracer',但未安装NodeJS. bundle install也可以正常工作,我也没有收到任何错误.

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.

推荐答案

您是否正在使用Ruby v2.0?尝试降级到1.9.

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

症状: JavaScript清单文件未编译,未显示任何错误;但是,在预处理"资产后,文件末尾会出现一个神秘的分号;.

解决方案: 降级到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

2013年编程真是令人遗憾!

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

这篇关于清单文件中未包含Javascript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆