# Rails: Asset `application.js` was not declared to be precompiled in production / The asset "application.css" is not present in the asset pipeline

**Code:** `Sprockets::Rails::Helper::AssetNotPrecompiled` · **Category:** Ruby / Rails · **Seen on:** Ruby

A layout references an asset that Sprockets doesn't know to compile or can't find.

## 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_tag` for a pack built elsewhere
- Digest/manifest cache stale

## Quick fix

1. Add `//= link_tree ../images` and `//= link application.css` to `app/assets/config/manifest.js`
2. `RAILS_ENV=production bin/rails assets:precompile`
3. Verify `public/assets/.sprockets-manifest*.json`

## Detailed fix by platform

### Rails

1. `bin/rails assets:clobber assets:precompile`

## How to diagnose

1. **manifest** — Linked?
2. **Precompile** — Run in deploy?
3. **File** — Exists?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ruby/rails-asset-not-precompiled)
