Rails: Asset `application.js` was not declared to be precompiled in production / The asset "application.css" is not present in the asset pipeline
A layout references an asset that Sprockets doesn't know to compile or can't find.
Asset `application.js` was not declared to be precompiled in productionThe asset "application.css" is not present in the asset pipelineSprockets::Rails::Helper::AssetNotFound: The asset "x.png" is not present in the asset pipelineActionView::Template::Error (The asset "application.css" is not present in the asset pipeline) Meaning
Add the file to app/assets/config/manifest.js (//= link application.js), check the file name/extension, run bin/rails assets:precompile, and in production make sure public/assets exists (or assets are served by the web server). config.assets.compile = false in production requires precompiled assets.
Common causes
- Asset not linked in manifest.js (Sprockets 4)
- File missing or renamed
- Assets not precompiled during deploy
javascript_include_tagfor a pack built elsewhere- Digest/manifest cache stale
⚡ Quick fix
- Add
//= link_tree ../imagesand//= link application.csstoapp/assets/config/manifest.js RAILS_ENV=production bin/rails assets:precompile- Verify
public/assets/.sprockets-manifest*.json
Detailed fix by platform
Rails
bin/rails assets:clobber assets:precompile
How to diagnose
- manifest — Linked?
- Precompile — Run in deploy?
- File — Exists?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- ActiveRecord::AssociationTypeMismatch Rails: ActiveRecord::AssociationTypeMismatch: User(#1234) expected, got "42" which is an instance of String(#5678)
- ActiveRecord::ConnectionNotEstablished Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found
- ActiveRecord::Deadlocked: PG::TRDeadlockDetected Rails: ActiveRecord::Deadlocked: PG::TRDeadlockDetected: ERROR: deadlock detected
Most viewed in Ruby / Rails
- ActiveRecord::PendingMigrationError Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate
- ActionController::InvalidAuthenticityToken Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity)
- undefined method for nil Ruby: NoMethodError: undefined method `x' for nil (nil:NilClass)
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026