Take the 2-minute tour ×

Ok so, I'm getting this error when I try to use the asset pipeline. I don't understand what's causing it.

Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Photos#show

Showing .../app/views/photos/_photo_view.html.haml where line #2 raised:

jquery.autocomplete isn't precompiled

Extracted source (around line #2):

1: - content_for :scripts do
2:  = javascript_include_tag 'jquery.autocomplete'

However, this IS precompiled. I ran rake assets:precompile RAILS_ENV=production before starting the server, and in my public/assets directory I have the file: jquery-5550a245a55b28927b5552cac182e612.autocomplete.js as well as .js.gz, and it's accurately reflected in the manifest:

application.js: application-4277323e3f7506b71f45c71e8a3a7c8f.js
jquery.autocomplete.js: jquery-5550a245a55b28927b5552cac182e612.autocomplete.js
jquery.cycle.all.min.js: jquery-183ef696b43944deaee5778d3094dbdd.cycle.all.min.js
jquery.fancybox.js: jquery-e52e44b2b4fb349bade9beb91461a810.fancybox.js
jquery.plupload.queue.js: jquery-f2e7f6ad7d2e5ca50235ed21f8d573cc.plupload.queue.js
jquery.tools.js: jquery-c53e304240fa56767fe0f2a00cb4bceb.tools.js
plupload.full.js: plupload-5dd26ee3fff6b627c19f196e9d1429dd.full.js
application.css: application-ce5217e1714cbc4e9c3ff6c5dfc9b221.css
fancybox.css: fancybox-9ee9c36f391086e4b0629b7df4042390.css
jquery.plupload.queue.css: jquery-661fbf3f503aa32ff11c004838c0820b.plupload.queue.css
jquery.js: jquery-4d23f0cfea862f56deb04f0a8ab1fcee.js
jquery.min.js: jquery-8a50feed8d29566738ad005e19fe1c2d.min.js

The javascript file in question is not loaded in my application.js file because I only need it on one view and don't use it anywhere else in the app. To account for that (and to fix sprockets trying to compile sass partials) I configured my precompile regexp like so:

config.assets.precompile = [/^[a-zA-Z]*\..*/]

(The above regexp precompiles any file that starts with a letter character, and ignores files starting with a non-letter character like an underscore).

Does anyone have any insight into what's causing this and how it can be fixed? The asset pipeline is making me pull my hair out!


just found out that Rails.configuration.assets.digests is returning nil in production. maybe the problem is there, for some reason sprockets is not finding the manifest.yml.

Im probably mistaken but seems like sprockets is not using the assets_host in config when looking for the manifest.yml.


share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

I have been wrestling with the problem myself, although with config.assets.compile = false set, as I suspect the example above was with the flag set to true.

Cannot configure assets via pipeline on local production rails 3.1.3 server

My observations came down to it being a Sprockets 2.0.3 bug, as UberNeet suggested towards. The workaround was to either remove the period from the asset name, or include it as part of a manifest, rather than link to it directly.

The bug report for this is here: https://github.com/rails/rails/issues/3398

Looking at your issue above, and tallying it with my experience from the last two days, I suspect there is an associated issue with asset naming when config.assets.compile = true is set. This issue probably stems from the asset naming - your manifest has the jquery.autocomplete library percompiled as:


But when you precompile these assets via rake using rake assets:precompile, I believe they are actually compiled to:


It is probably this discrepancy that is causing the issue you mentioned. Might be worth raising another github issue for this too, although the workarounds are listed above, and I understand that Rails 3.2 will be using Sprockets 2.1.0, which may contain the fix for this issue already.

share|improve this answer
I think that's it. My bug eventually went away but I never figured out why -- at some point I changed the file structure and it seemingly magically disappeared, now I guess I know why. –  Andrew Jan 21 '12 at 17:39
add comment

Add the .js to

javascript_include_tag 'jquery.autocomplete.js'

Seems like there is an missing functionality. When the filename has a period '.' in the name, the .js extension will not get added when looking into the digest.

I did some debugging to Sprockets::Helpers::RailsHelper and it seems like digest_for methods gets the logical path without the .js.

share|improve this answer
Thanks for this answer, this saved me from much aggravation –  deadkarma Mar 22 '12 at 14:27
works for me, eventhough my filename does not have period: supersleight.js isn't precompiled at <%= javascript_include_tag 'supersleight' %> though supersleight-d7d35147a0247a59d432bbe763e54a1a.js has been compiled and sitting under public/assets/ folder. I have added config.assets.precompile << 'supersleight.js' under application.rb. config.assets.compile = false too. –  lulalala May 30 '12 at 9:46
add comment

Be shure that it isn't required before in application.js for example.

share|improve this answer
add comment

Your Answer


