Ashiful Islam Prince
Ashiful Islam Prince

Reputation: 238

laravel is unable to get webfonts from localhost

I wanted to integrate font-awesome in my Laravel project. But I having a bit of a strange error.

The error shows in the console when I run the project:

 GET http://localhost/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff2?55071ae1abc18726e23174192ebc0b68 net::ERR_ABORTED 404 (Not Found)

Here is the app.scss file:

// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');

  // Variables
  @import 'variables';
  $fa-font-path:"../webfonts";

  // Bootstrap
  @import '~bootstrap/scss/bootstrap';
  @import '~admin-lte/dist/css/adminlte.css';

  @import "~@fortawesome/fontawesome-free/scss/fontawesome.scss";
  @import "~@fortawesome/fontawesome-free/scss/solid.scss";
  @import "~@fortawesome/fontawesome-free/scss/brands.scss";

In above, I have imported all of the required files

Here is the package.json file:

{
"private": true,
"scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
    "axios": "^0.19",
    "bootstrap": "^4.0.0",
    "cross-env": "^7.0",
    "jquery": "^3.2",
    "laravel-mix": "^5.0.1",
    "lodash": "^4.17.19",
    "popper.js": "^1.12",
    "resolve-url-loader": "^2.3.1",
    "sass": "^1.20.1",
    "sass-loader": "^8.0.0",
    "vue": "^2.5.17",
    "vue-template-compiler": "^2.6.10"
},
"dependencies": {
    "@fortawesome/fontawesome-free": "^5.15.0",
    "admin-lte": "^3.0.0-alpha.2"
}
}

In above, I added the dependencies through npm

I don't know where I made the problem. I run these commands to solve this issue:

php artisan run dev
php artisan run watch

But I could not come to escape with the solution. How can I solve that? Thank you in advance.

Upvotes: 2

Views: 800

Answers (1)

kadiro
kadiro

Reputation: 1116

in your .env file try to make your

host = localhost:8000

Upvotes: 1

Related Questions