且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

资产"application.js"在资产管道中不存在

更新时间:2022-11-06 14:15:40

首先尝试重新启动服务器,通常不需要在资产中包含application.js文件.如果不起作用,则

first of all try to restart your server, generally there is no need to include application.js file in assets. if it doesn't work then

在您的 config / initializer / assets.rb 文件中添加以下内容:

add below in your config / initializer / assets.rb file:

Rails.application.config.assets.precompile += %w(application.js)

注意:添加资产文件后,请不要忘记重启服务器.如果您在Inilalizers中进行了任何更改,则必须重新启动服务器才能看到效果.

Note: after adding in your assets file, don't forget to restart your server. If you do any changes in Inilalizers, you have to restart the server to see the effects.