Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

harshsaini's avatar

FontAwesome Not Loading After Running npm run production

I'm facing an issue when running npm run production. After the build process, several CSS-related files are created, including one named abc.css. However, FontAwesome is not loading in this file. Even though I can find it by searching within the file, the icons are not displaying in the project after refreshing the page. How can I resolve this issue and get FontAwesome icons to show properly?

TRY : I made changes to the CSS and ran npm run production, but the same issue persists. I also re-ran npm run production on the old file that was working, but the issue remains. After removing the node_modules folder and running npm install, the problem is still the same.

0 likes
1 reply
RemiM's avatar

For a fresh Font Awesome installation, follow these steps:

Install Font Awesome via npm:

First, run the following command in your project directory:

npm install --save @fortawesome/fontawesome-free

Import Font Awesome in app.css:

Open your app.css file (or equivalent) and add the following line at the very top:

@import '@fortawesome/fontawesome-free/css/all.css';

Use Font Awesome icons in your Blade files:

Add an icon to your Blade view, like this:

<i class="fas fa-home"></i>

Run npm run dev:

To build and check if everything is working properly, run:

npm run dev

If you run into any issues with your Node.js version, your terminal should inform you if the version is incompatible. In my case, I had to switch to v22.11.0 to resolve compatibility problems.

Font Awesome should work seamlessly in both development and production environments.

Please or to participate in this conversation.