简体   繁体   English

无法加载此类文件— coffee_script

[英]cannot load such file — coffee_script

I'm going to remove active_admin from my angular rails app. 我将从我的angular rails应用程序中删除active_admin。 So I ran the following commands. 因此,我运行了以下命令。

rails destroy active_admin:install
rails destroy active_admin:resource product

And I met this error. 我遇到了这个错误。

cannot load such file -- coffee_script

<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application' %>

Try 尝试

rake tmp:cache:clear

or 要么

try adding "gem 'coffee-rails', '~> 4.1.0'" to the Gemfile and running bundle:install . 尝试将"gem 'coffee-rails', '~> 4.1.0'" gem'coffee "gem 'coffee-rails', '~> 4.1.0'"到Gemfile并运行bundle:install

in rails > 5.2 在导轨> 5.2

we need to use rake rails tmp:cache:clear 我们需要使用rake rails tmp:cache:clear

It may be the cache. 它可能是缓存。 Try this: rake tmp:cache:clear and restart your server. 试试这个: rake tmp:cache:clear并重新启动服务器。

In case anyone started the project without --skip-coffee flag but then remove coffee-rails gem later. 如果有人在没有--skip-coffee标志的情况下启动了该项目,但随后又删除了咖啡栏上的宝石。 This could result in the same error. 这可能会导致相同的错误。

In that case try renaming all *.coffee or *.js.coffee to just *.js . 在这种情况下,请尝试将所有*.coffee*.js.coffee重命名为*.js Also, rake tmp:cache:clear and restart server 另外, rake tmp:cache:clear并重新启动服务器

Having the same issue, none of the solutions above worked for me. 遇到相同的问题,以上所有解决方案都不适合我。

Using rails 5.2.2, I added gem 'coffee-rails', '~> 5.0.0 使用rails 5.2.2,我添加了gem 'coffee-rails', '~> 5.0.0

Then bundle:install and rails tmp:cache:clear 然后bundle:installrails tmp:cache:clear

Finally, I've restarted the server and all worked fine. 最后,我重新启动了服务器,一切正常。

Hope this help. 希望对您有所帮助。

Clear Cache 清除缓存

Like the other answers say: 像其他答案一样:

rake tmp:cache:clear

Do you have any coffee script files? 你有咖啡脚本文件吗?

Likely, look in your assets/javascripts file: there may be some coffee script files in there. 可能,请查看您的资产/ javascript文件:其中可能有一些咖啡脚本文件。 If you don't need them, then you can get can simply delete. 如果不需要它们,则可以将其删除。 Now try again and it should work. 现在再试一次,它应该可以工作。

If you have coffee script files that you want to keep: 如果您有要保留的咖啡脚本文件:

Then add the following to your gemfile and run bundle install 然后将以下内容添加到您的gemfile中并运行bundle install

gem 'coffee-rails', '~> 5.0.0'

It should now work. 现在应该可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM